blob 992cd23b (48707B) - Raw
1 const std = @import("std"); 2 const builtin = @import("builtin"); 3 const is_test = builtin.is_test; 4 const os_tag = builtin.os.tag; 5 const arch = builtin.cpu.arch; 6 const abi = builtin.abi; 7 8 const is_gnu = abi.isGnu(); 9 const is_mingw = os_tag == .windows and is_gnu; 10 const is_darwin = std.Target.Os.Tag.isDarwin(os_tag); 11 12 const linkage = if (is_test) 13 std.builtin.GlobalLinkage.Internal 14 else 15 std.builtin.GlobalLinkage.Weak; 16 17 const strong_linkage = if (is_test) 18 std.builtin.GlobalLinkage.Internal 19 else 20 std.builtin.GlobalLinkage.Strong; 21 22 const long_double_is_f80 = builtin.target.longDoubleIs(f80); 23 const long_double_is_f128 = builtin.target.longDoubleIs(f128); 24 25 comptime { 26 // These files do their own comptime exporting logic. 27 _ = @import("compiler_rt/atomics.zig"); 28 if (builtin.zig_backend != .stage2_llvm) { // TODO 29 _ = @import("compiler_rt/clear_cache.zig").clear_cache; 30 } 31 32 const __extenddftf2 = @import("compiler_rt/extendXfYf2.zig").__extenddftf2; 33 @export(__extenddftf2, .{ .name = "__extenddftf2", .linkage = linkage }); 34 const __extendsftf2 = @import("compiler_rt/extendXfYf2.zig").__extendsftf2; 35 @export(__extendsftf2, .{ .name = "__extendsftf2", .linkage = linkage }); 36 const __extendhfsf2 = @import("compiler_rt/extendXfYf2.zig").__extendhfsf2; 37 @export(__extendhfsf2, .{ .name = "__extendhfsf2", .linkage = linkage }); 38 const __extendhftf2 = @import("compiler_rt/extendXfYf2.zig").__extendhftf2; 39 @export(__extendhftf2, .{ .name = "__extendhftf2", .linkage = linkage }); 40 41 const __extendhfxf2 = @import("compiler_rt/extend_f80.zig").__extendhfxf2; 42 @export(__extendhfxf2, .{ .name = "__extendhfxf2", .linkage = linkage }); 43 const __extendsfxf2 = @import("compiler_rt/extend_f80.zig").__extendsfxf2; 44 @export(__extendsfxf2, .{ .name = "__extendsfxf2", .linkage = linkage }); 45 const __extenddfxf2 = @import("compiler_rt/extend_f80.zig").__extenddfxf2; 46 @export(__extenddfxf2, .{ .name = "__extenddfxf2", .linkage = linkage }); 47 const __extendxftf2 = @import("compiler_rt/extend_f80.zig").__extendxftf2; 48 @export(__extendxftf2, .{ .name = "__extendxftf2", .linkage = linkage }); 49 50 const __lesf2 = @import("compiler_rt/compareXf2.zig").__lesf2; 51 @export(__lesf2, .{ .name = "__lesf2", .linkage = linkage }); 52 const __ledf2 = @import("compiler_rt/compareXf2.zig").__ledf2; 53 @export(__ledf2, .{ .name = "__ledf2", .linkage = linkage }); 54 const __letf2 = @import("compiler_rt/compareXf2.zig").__letf2; 55 @export(__letf2, .{ .name = "__letf2", .linkage = linkage }); 56 const __lexf2 = @import("compiler_rt/compareXf2.zig").__lexf2; 57 @export(__lexf2, .{ .name = "__lexf2", .linkage = linkage }); 58 59 const __gesf2 = @import("compiler_rt/compareXf2.zig").__gesf2; 60 @export(__gesf2, .{ .name = "__gesf2", .linkage = linkage }); 61 const __gedf2 = @import("compiler_rt/compareXf2.zig").__gedf2; 62 @export(__gedf2, .{ .name = "__gedf2", .linkage = linkage }); 63 const __getf2 = @import("compiler_rt/compareXf2.zig").__getf2; 64 @export(__getf2, .{ .name = "__getf2", .linkage = linkage }); 65 const __gexf2 = @import("compiler_rt/compareXf2.zig").__gexf2; 66 @export(__gexf2, .{ .name = "__gexf2", .linkage = linkage }); 67 68 const __eqsf2 = @import("compiler_rt/compareXf2.zig").__eqsf2; 69 @export(__eqsf2, .{ .name = "__eqsf2", .linkage = linkage }); 70 const __eqdf2 = @import("compiler_rt/compareXf2.zig").__eqdf2; 71 @export(__eqdf2, .{ .name = "__eqdf2", .linkage = linkage }); 72 const __eqxf2 = @import("compiler_rt/compareXf2.zig").__eqxf2; 73 @export(__eqxf2, .{ .name = "__eqxf2", .linkage = linkage }); 74 75 const __ltsf2 = @import("compiler_rt/compareXf2.zig").__ltsf2; 76 @export(__ltsf2, .{ .name = "__ltsf2", .linkage = linkage }); 77 const __ltdf2 = @import("compiler_rt/compareXf2.zig").__ltdf2; 78 @export(__ltdf2, .{ .name = "__ltdf2", .linkage = linkage }); 79 const __ltxf2 = @import("compiler_rt/compareXf2.zig").__ltxf2; 80 @export(__ltxf2, .{ .name = "__ltxf2", .linkage = linkage }); 81 82 const __nesf2 = @import("compiler_rt/compareXf2.zig").__nesf2; 83 @export(__nesf2, .{ .name = "__nesf2", .linkage = linkage }); 84 const __nedf2 = @import("compiler_rt/compareXf2.zig").__nedf2; 85 @export(__nedf2, .{ .name = "__nedf2", .linkage = linkage }); 86 const __nexf2 = @import("compiler_rt/compareXf2.zig").__nexf2; 87 @export(__nexf2, .{ .name = "__nexf2", .linkage = linkage }); 88 89 const __gtsf2 = @import("compiler_rt/compareXf2.zig").__gtsf2; 90 @export(__gtsf2, .{ .name = "__gtsf2", .linkage = linkage }); 91 const __gtdf2 = @import("compiler_rt/compareXf2.zig").__gtdf2; 92 @export(__gtdf2, .{ .name = "__gtdf2", .linkage = linkage }); 93 const __gtxf2 = @import("compiler_rt/compareXf2.zig").__gtxf2; 94 @export(__gtxf2, .{ .name = "__gtxf2", .linkage = linkage }); 95 96 if (!is_test) { 97 @export(__lesf2, .{ .name = "__cmpsf2", .linkage = linkage }); 98 @export(__ledf2, .{ .name = "__cmpdf2", .linkage = linkage }); 99 @export(__letf2, .{ .name = "__cmptf2", .linkage = linkage }); 100 @export(__letf2, .{ .name = "__eqtf2", .linkage = linkage }); 101 @export(__letf2, .{ .name = "__lttf2", .linkage = linkage }); 102 @export(__getf2, .{ .name = "__gttf2", .linkage = linkage }); 103 @export(__letf2, .{ .name = "__netf2", .linkage = linkage }); 104 @export(__extendhfsf2, .{ .name = "__gnu_h2f_ieee", .linkage = linkage }); 105 } 106 107 if (builtin.os.tag == .windows) { 108 // Default stack-probe functions emitted by LLVM 109 if (is_mingw) { 110 const _chkstk = @import("compiler_rt/stack_probe.zig")._chkstk; 111 @export(_chkstk, .{ .name = "_alloca", .linkage = strong_linkage }); 112 const ___chkstk_ms = @import("compiler_rt/stack_probe.zig").___chkstk_ms; 113 @export(___chkstk_ms, .{ .name = "___chkstk_ms", .linkage = strong_linkage }); 114 } else if (!builtin.link_libc) { 115 // This symbols are otherwise exported by MSVCRT.lib 116 const _chkstk = @import("compiler_rt/stack_probe.zig")._chkstk; 117 @export(_chkstk, .{ .name = "_chkstk", .linkage = strong_linkage }); 118 const __chkstk = @import("compiler_rt/stack_probe.zig").__chkstk; 119 @export(__chkstk, .{ .name = "__chkstk", .linkage = strong_linkage }); 120 } 121 122 switch (arch) { 123 .i386 => { 124 const __divti3 = @import("compiler_rt/divti3.zig").__divti3; 125 @export(__divti3, .{ .name = "__divti3", .linkage = linkage }); 126 const __modti3 = @import("compiler_rt/modti3.zig").__modti3; 127 @export(__modti3, .{ .name = "__modti3", .linkage = linkage }); 128 const __multi3 = @import("compiler_rt/multi3.zig").__multi3; 129 @export(__multi3, .{ .name = "__multi3", .linkage = linkage }); 130 const __udivti3 = @import("compiler_rt/udivti3.zig").__udivti3; 131 @export(__udivti3, .{ .name = "__udivti3", .linkage = linkage }); 132 const __udivmodti4 = @import("compiler_rt/udivmodti4.zig").__udivmodti4; 133 @export(__udivmodti4, .{ .name = "__udivmodti4", .linkage = linkage }); 134 const __umodti3 = @import("compiler_rt/umodti3.zig").__umodti3; 135 @export(__umodti3, .{ .name = "__umodti3", .linkage = linkage }); 136 }, 137 .x86_64 => { 138 // The "ti" functions must use Vector(2, u64) parameter types to adhere to the ABI 139 // that LLVM expects compiler-rt to have. 140 const __divti3_windows_x86_64 = @import("compiler_rt/divti3.zig").__divti3_windows_x86_64; 141 @export(__divti3_windows_x86_64, .{ .name = "__divti3", .linkage = linkage }); 142 const __modti3_windows_x86_64 = @import("compiler_rt/modti3.zig").__modti3_windows_x86_64; 143 @export(__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = linkage }); 144 const __multi3_windows_x86_64 = @import("compiler_rt/multi3.zig").__multi3_windows_x86_64; 145 @export(__multi3_windows_x86_64, .{ .name = "__multi3", .linkage = linkage }); 146 const __udivti3_windows_x86_64 = @import("compiler_rt/udivti3.zig").__udivti3_windows_x86_64; 147 @export(__udivti3_windows_x86_64, .{ .name = "__udivti3", .linkage = linkage }); 148 const __udivmodti4_windows_x86_64 = @import("compiler_rt/udivmodti4.zig").__udivmodti4_windows_x86_64; 149 @export(__udivmodti4_windows_x86_64, .{ .name = "__udivmodti4", .linkage = linkage }); 150 const __umodti3_windows_x86_64 = @import("compiler_rt/umodti3.zig").__umodti3_windows_x86_64; 151 @export(__umodti3_windows_x86_64, .{ .name = "__umodti3", .linkage = linkage }); 152 }, 153 else => {}, 154 } 155 if (arch.isAARCH64()) { 156 const __chkstk = @import("compiler_rt/stack_probe.zig").__chkstk; 157 @export(__chkstk, .{ .name = "__chkstk", .linkage = strong_linkage }); 158 const __divti3_windows = @import("compiler_rt/divti3.zig").__divti3; 159 @export(__divti3_windows, .{ .name = "__divti3", .linkage = linkage }); 160 const __modti3 = @import("compiler_rt/modti3.zig").__modti3; 161 @export(__modti3, .{ .name = "__modti3", .linkage = linkage }); 162 const __udivti3_windows = @import("compiler_rt/udivti3.zig").__udivti3; 163 @export(__udivti3_windows, .{ .name = "__udivti3", .linkage = linkage }); 164 const __umodti3 = @import("compiler_rt/umodti3.zig").__umodti3; 165 @export(__umodti3, .{ .name = "__umodti3", .linkage = linkage }); 166 } 167 } else { 168 const __divti3 = @import("compiler_rt/divti3.zig").__divti3; 169 @export(__divti3, .{ .name = "__divti3", .linkage = linkage }); 170 const __modti3 = @import("compiler_rt/modti3.zig").__modti3; 171 @export(__modti3, .{ .name = "__modti3", .linkage = linkage }); 172 const __multi3 = @import("compiler_rt/multi3.zig").__multi3; 173 @export(__multi3, .{ .name = "__multi3", .linkage = linkage }); 174 const __udivti3 = @import("compiler_rt/udivti3.zig").__udivti3; 175 @export(__udivti3, .{ .name = "__udivti3", .linkage = linkage }); 176 const __udivmodti4 = @import("compiler_rt/udivmodti4.zig").__udivmodti4; 177 @export(__udivmodti4, .{ .name = "__udivmodti4", .linkage = linkage }); 178 const __umodti3 = @import("compiler_rt/umodti3.zig").__umodti3; 179 @export(__umodti3, .{ .name = "__umodti3", .linkage = linkage }); 180 } 181 182 const __truncdfhf2 = @import("compiler_rt/truncXfYf2.zig").__truncdfhf2; 183 @export(__truncdfhf2, .{ .name = "__truncdfhf2", .linkage = linkage }); 184 const __trunctfhf2 = @import("compiler_rt/truncXfYf2.zig").__trunctfhf2; 185 @export(__trunctfhf2, .{ .name = "__trunctfhf2", .linkage = linkage }); 186 const __trunctfdf2 = @import("compiler_rt/truncXfYf2.zig").__trunctfdf2; 187 @export(__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = linkage }); 188 const __trunctfsf2 = @import("compiler_rt/truncXfYf2.zig").__trunctfsf2; 189 @export(__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = linkage }); 190 191 const __truncdfsf2 = @import("compiler_rt/truncXfYf2.zig").__truncdfsf2; 192 @export(__truncdfsf2, .{ .name = "__truncdfsf2", .linkage = linkage }); 193 194 const __truncxfhf2 = @import("compiler_rt/trunc_f80.zig").__truncxfhf2; 195 @export(__truncxfhf2, .{ .name = "__truncxfhf2", .linkage = linkage }); 196 const __truncxfsf2 = @import("compiler_rt/trunc_f80.zig").__truncxfsf2; 197 @export(__truncxfsf2, .{ .name = "__truncxfsf2", .linkage = linkage }); 198 const __truncxfdf2 = @import("compiler_rt/trunc_f80.zig").__truncxfdf2; 199 @export(__truncxfdf2, .{ .name = "__truncxfdf2", .linkage = linkage }); 200 const __trunctfxf2 = @import("compiler_rt/trunc_f80.zig").__trunctfxf2; 201 @export(__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = linkage }); 202 203 if (builtin.zig_backend == .stage1) { // TODO 204 switch (arch) { 205 .i386, 206 .x86_64, 207 => { 208 const zig_probe_stack = @import("compiler_rt/stack_probe.zig").zig_probe_stack; 209 @export(zig_probe_stack, .{ 210 .name = "__zig_probe_stack", 211 .linkage = linkage, 212 }); 213 }, 214 else => {}, 215 } 216 } 217 218 const __unordsf2 = @import("compiler_rt/compareXf2.zig").__unordsf2; 219 @export(__unordsf2, .{ .name = "__unordsf2", .linkage = linkage }); 220 const __unorddf2 = @import("compiler_rt/compareXf2.zig").__unorddf2; 221 @export(__unorddf2, .{ .name = "__unorddf2", .linkage = linkage }); 222 const __unordtf2 = @import("compiler_rt/compareXf2.zig").__unordtf2; 223 @export(__unordtf2, .{ .name = "__unordtf2", .linkage = linkage }); 224 225 const __addsf3 = @import("compiler_rt/addXf3.zig").__addsf3; 226 @export(__addsf3, .{ .name = "__addsf3", .linkage = linkage }); 227 const __adddf3 = @import("compiler_rt/addXf3.zig").__adddf3; 228 @export(__adddf3, .{ .name = "__adddf3", .linkage = linkage }); 229 const __addtf3 = @import("compiler_rt/addXf3.zig").__addtf3; 230 @export(__addtf3, .{ .name = "__addtf3", .linkage = linkage }); 231 const __addxf3 = @import("compiler_rt/addXf3.zig").__addxf3; 232 @export(__addxf3, .{ .name = "__addxf3", .linkage = linkage }); 233 const __subsf3 = @import("compiler_rt/addXf3.zig").__subsf3; 234 @export(__subsf3, .{ .name = "__subsf3", .linkage = linkage }); 235 const __subdf3 = @import("compiler_rt/addXf3.zig").__subdf3; 236 @export(__subdf3, .{ .name = "__subdf3", .linkage = linkage }); 237 const __subtf3 = @import("compiler_rt/addXf3.zig").__subtf3; 238 @export(__subtf3, .{ .name = "__subtf3", .linkage = linkage }); 239 const __subxf3 = @import("compiler_rt/addXf3.zig").__subxf3; 240 @export(__subxf3, .{ .name = "__subxf3", .linkage = linkage }); 241 242 const __mulsf3 = @import("compiler_rt/mulXf3.zig").__mulsf3; 243 @export(__mulsf3, .{ .name = "__mulsf3", .linkage = linkage }); 244 const __muldf3 = @import("compiler_rt/mulXf3.zig").__muldf3; 245 @export(__muldf3, .{ .name = "__muldf3", .linkage = linkage }); 246 const __multf3 = @import("compiler_rt/mulXf3.zig").__multf3; 247 @export(__multf3, .{ .name = "__multf3", .linkage = linkage }); 248 249 const __divsf3 = @import("compiler_rt/divsf3.zig").__divsf3; 250 @export(__divsf3, .{ .name = "__divsf3", .linkage = linkage }); 251 const __divdf3 = @import("compiler_rt/divdf3.zig").__divdf3; 252 @export(__divdf3, .{ .name = "__divdf3", .linkage = linkage }); 253 const __divtf3 = @import("compiler_rt/divtf3.zig").__divtf3; 254 @export(__divtf3, .{ .name = "__divtf3", .linkage = linkage }); 255 256 // Integer Bit operations 257 const __clzsi2 = @import("compiler_rt/count0bits.zig").__clzsi2; 258 @export(__clzsi2, .{ .name = "__clzsi2", .linkage = linkage }); 259 const __clzdi2 = @import("compiler_rt/count0bits.zig").__clzdi2; 260 @export(__clzdi2, .{ .name = "__clzdi2", .linkage = linkage }); 261 const __clzti2 = @import("compiler_rt/count0bits.zig").__clzti2; 262 @export(__clzti2, .{ .name = "__clzti2", .linkage = linkage }); 263 const __ctzsi2 = @import("compiler_rt/count0bits.zig").__ctzsi2; 264 @export(__ctzsi2, .{ .name = "__ctzsi2", .linkage = linkage }); 265 const __ctzdi2 = @import("compiler_rt/count0bits.zig").__ctzdi2; 266 @export(__ctzdi2, .{ .name = "__ctzdi2", .linkage = linkage }); 267 const __ctzti2 = @import("compiler_rt/count0bits.zig").__ctzti2; 268 @export(__ctzti2, .{ .name = "__ctzti2", .linkage = linkage }); 269 const __ffssi2 = @import("compiler_rt/count0bits.zig").__ffssi2; 270 @export(__ffssi2, .{ .name = "__ffssi2", .linkage = linkage }); 271 const __ffsdi2 = @import("compiler_rt/count0bits.zig").__ffsdi2; 272 @export(__ffsdi2, .{ .name = "__ffsdi2", .linkage = linkage }); 273 const __ffsti2 = @import("compiler_rt/count0bits.zig").__ffsti2; 274 @export(__ffsti2, .{ .name = "__ffsti2", .linkage = linkage }); 275 const __paritysi2 = @import("compiler_rt/parity.zig").__paritysi2; 276 @export(__paritysi2, .{ .name = "__paritysi2", .linkage = linkage }); 277 const __paritydi2 = @import("compiler_rt/parity.zig").__paritydi2; 278 @export(__paritydi2, .{ .name = "__paritydi2", .linkage = linkage }); 279 const __parityti2 = @import("compiler_rt/parity.zig").__parityti2; 280 @export(__parityti2, .{ .name = "__parityti2", .linkage = linkage }); 281 const __popcountsi2 = @import("compiler_rt/popcount.zig").__popcountsi2; 282 @export(__popcountsi2, .{ .name = "__popcountsi2", .linkage = linkage }); 283 const __popcountdi2 = @import("compiler_rt/popcount.zig").__popcountdi2; 284 @export(__popcountdi2, .{ .name = "__popcountdi2", .linkage = linkage }); 285 const __popcountti2 = @import("compiler_rt/popcount.zig").__popcountti2; 286 @export(__popcountti2, .{ .name = "__popcountti2", .linkage = linkage }); 287 const __bswapsi2 = @import("compiler_rt/bswap.zig").__bswapsi2; 288 @export(__bswapsi2, .{ .name = "__bswapsi2", .linkage = linkage }); 289 const __bswapdi2 = @import("compiler_rt/bswap.zig").__bswapdi2; 290 @export(__bswapdi2, .{ .name = "__bswapdi2", .linkage = linkage }); 291 const __bswapti2 = @import("compiler_rt/bswap.zig").__bswapti2; 292 @export(__bswapti2, .{ .name = "__bswapti2", .linkage = linkage }); 293 294 // Integral / floating point conversion (part 1/2) 295 const __floatsidf = @import("compiler_rt/floatsiXf.zig").__floatsidf; 296 @export(__floatsidf, .{ .name = "__floatsidf", .linkage = linkage }); 297 const __floatsisf = @import("compiler_rt/floatsiXf.zig").__floatsisf; 298 @export(__floatsisf, .{ .name = "__floatsisf", .linkage = linkage }); 299 const __floatdidf = @import("compiler_rt/floatdidf.zig").__floatdidf; 300 @export(__floatdidf, .{ .name = "__floatdidf", .linkage = linkage }); 301 const __floatsitf = @import("compiler_rt/floatsiXf.zig").__floatsitf; 302 @export(__floatsitf, .{ .name = "__floatsitf", .linkage = linkage }); 303 304 const __floatunsisf = @import("compiler_rt/floatunsisf.zig").__floatunsisf; 305 @export(__floatunsisf, .{ .name = "__floatunsisf", .linkage = linkage }); 306 if (builtin.zig_backend == .stage1) { // TODO it's crashing on a switch expression 307 const __floatundisf = @import("compiler_rt/floatundisf.zig").__floatundisf; 308 @export(__floatundisf, .{ .name = "__floatundisf", .linkage = linkage }); 309 } 310 const __floatunsidf = @import("compiler_rt/floatunsidf.zig").__floatunsidf; 311 @export(__floatunsidf, .{ .name = "__floatunsidf", .linkage = linkage }); 312 const __floatundidf = @import("compiler_rt/floatundidf.zig").__floatundidf; 313 @export(__floatundidf, .{ .name = "__floatundidf", .linkage = linkage }); 314 315 const __floatditf = @import("compiler_rt/floatditf.zig").__floatditf; 316 @export(__floatditf, .{ .name = "__floatditf", .linkage = linkage }); 317 const __floattitf = @import("compiler_rt/floattitf.zig").__floattitf; 318 @export(__floattitf, .{ .name = "__floattitf", .linkage = linkage }); 319 const __floattidf = @import("compiler_rt/floattidf.zig").__floattidf; 320 @export(__floattidf, .{ .name = "__floattidf", .linkage = linkage }); 321 const __floattisf = @import("compiler_rt/floatXisf.zig").__floattisf; 322 @export(__floattisf, .{ .name = "__floattisf", .linkage = linkage }); 323 const __floatdisf = @import("compiler_rt/floatXisf.zig").__floatdisf; 324 @export(__floatdisf, .{ .name = "__floatdisf", .linkage = linkage }); 325 326 const __floatunditf = @import("compiler_rt/floatunditf.zig").__floatunditf; 327 @export(__floatunditf, .{ .name = "__floatunditf", .linkage = linkage }); 328 const __floatunsitf = @import("compiler_rt/floatunsitf.zig").__floatunsitf; 329 @export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = linkage }); 330 331 const __floatuntitf = @import("compiler_rt/floatuntitf.zig").__floatuntitf; 332 @export(__floatuntitf, .{ .name = "__floatuntitf", .linkage = linkage }); 333 const __floatuntidf = @import("compiler_rt/floatuntidf.zig").__floatuntidf; 334 @export(__floatuntidf, .{ .name = "__floatuntidf", .linkage = linkage }); 335 const __floatuntisf = @import("compiler_rt/floatuntisf.zig").__floatuntisf; 336 @export(__floatuntisf, .{ .name = "__floatuntisf", .linkage = linkage }); 337 338 const __truncsfhf2 = @import("compiler_rt/truncXfYf2.zig").__truncsfhf2; 339 @export(__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = linkage }); 340 if (!is_test) { 341 @export(__truncsfhf2, .{ .name = "__gnu_f2h_ieee", .linkage = linkage }); 342 } 343 const __extendsfdf2 = @import("compiler_rt/extendXfYf2.zig").__extendsfdf2; 344 @export(__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = linkage }); 345 346 // Integral / floating point conversion (part 2/2) 347 const __fixunssfsi = @import("compiler_rt/fixunssfsi.zig").__fixunssfsi; 348 @export(__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = linkage }); 349 const __fixunssfdi = @import("compiler_rt/fixunssfdi.zig").__fixunssfdi; 350 @export(__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = linkage }); 351 const __fixunssfti = @import("compiler_rt/fixunssfti.zig").__fixunssfti; 352 @export(__fixunssfti, .{ .name = "__fixunssfti", .linkage = linkage }); 353 354 const __fixunsdfsi = @import("compiler_rt/fixunsdfsi.zig").__fixunsdfsi; 355 @export(__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = linkage }); 356 const __fixunsdfdi = @import("compiler_rt/fixunsdfdi.zig").__fixunsdfdi; 357 @export(__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = linkage }); 358 const __fixunsdfti = @import("compiler_rt/fixunsdfti.zig").__fixunsdfti; 359 @export(__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = linkage }); 360 361 const __fixunstfsi = @import("compiler_rt/fixunstfsi.zig").__fixunstfsi; 362 @export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = linkage }); 363 const __fixunstfdi = @import("compiler_rt/fixunstfdi.zig").__fixunstfdi; 364 @export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = linkage }); 365 const __fixunstfti = @import("compiler_rt/fixunstfti.zig").__fixunstfti; 366 @export(__fixunstfti, .{ .name = "__fixunstfti", .linkage = linkage }); 367 368 const __fixdfdi = @import("compiler_rt/fixdfdi.zig").__fixdfdi; 369 @export(__fixdfdi, .{ .name = "__fixdfdi", .linkage = linkage }); 370 const __fixdfsi = @import("compiler_rt/fixdfsi.zig").__fixdfsi; 371 @export(__fixdfsi, .{ .name = "__fixdfsi", .linkage = linkage }); 372 const __fixdfti = @import("compiler_rt/fixdfti.zig").__fixdfti; 373 @export(__fixdfti, .{ .name = "__fixdfti", .linkage = linkage }); 374 const __fixsfdi = @import("compiler_rt/fixsfdi.zig").__fixsfdi; 375 @export(__fixsfdi, .{ .name = "__fixsfdi", .linkage = linkage }); 376 const __fixsfsi = @import("compiler_rt/fixsfsi.zig").__fixsfsi; 377 @export(__fixsfsi, .{ .name = "__fixsfsi", .linkage = linkage }); 378 const __fixsfti = @import("compiler_rt/fixsfti.zig").__fixsfti; 379 @export(__fixsfti, .{ .name = "__fixsfti", .linkage = linkage }); 380 const __fixtfdi = @import("compiler_rt/fixtfdi.zig").__fixtfdi; 381 @export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = linkage }); 382 const __fixtfsi = @import("compiler_rt/fixtfsi.zig").__fixtfsi; 383 @export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = linkage }); 384 const __fixtfti = @import("compiler_rt/fixtfti.zig").__fixtfti; 385 @export(__fixtfti, .{ .name = "__fixtfti", .linkage = linkage }); 386 387 const __udivmoddi4 = @import("compiler_rt/int.zig").__udivmoddi4; 388 @export(__udivmoddi4, .{ .name = "__udivmoddi4", .linkage = linkage }); 389 390 if (is_darwin) { 391 const __isPlatformVersionAtLeast = @import("compiler_rt/os_version_check.zig").__isPlatformVersionAtLeast; 392 @export(__isPlatformVersionAtLeast, .{ .name = "__isPlatformVersionAtLeast", .linkage = linkage }); 393 } 394 395 // Integer Arithmetic 396 const __ashldi3 = @import("compiler_rt/shift.zig").__ashldi3; 397 @export(__ashldi3, .{ .name = "__ashldi3", .linkage = linkage }); 398 const __ashlti3 = @import("compiler_rt/shift.zig").__ashlti3; 399 @export(__ashlti3, .{ .name = "__ashlti3", .linkage = linkage }); 400 const __ashrdi3 = @import("compiler_rt/shift.zig").__ashrdi3; 401 @export(__ashrdi3, .{ .name = "__ashrdi3", .linkage = linkage }); 402 const __ashrti3 = @import("compiler_rt/shift.zig").__ashrti3; 403 @export(__ashrti3, .{ .name = "__ashrti3", .linkage = linkage }); 404 const __lshrdi3 = @import("compiler_rt/shift.zig").__lshrdi3; 405 @export(__lshrdi3, .{ .name = "__lshrdi3", .linkage = linkage }); 406 const __lshrti3 = @import("compiler_rt/shift.zig").__lshrti3; 407 @export(__lshrti3, .{ .name = "__lshrti3", .linkage = linkage }); 408 const __negsi2 = @import("compiler_rt/negXi2.zig").__negsi2; 409 @export(__negsi2, .{ .name = "__negsi2", .linkage = linkage }); 410 const __negdi2 = @import("compiler_rt/negXi2.zig").__negdi2; 411 @export(__negdi2, .{ .name = "__negdi2", .linkage = linkage }); 412 const __negti2 = @import("compiler_rt/negXi2.zig").__negti2; 413 @export(__negti2, .{ .name = "__negti2", .linkage = linkage }); 414 415 const __mulsi3 = @import("compiler_rt/int.zig").__mulsi3; 416 @export(__mulsi3, .{ .name = "__mulsi3", .linkage = linkage }); 417 const __muldi3 = @import("compiler_rt/muldi3.zig").__muldi3; 418 @export(__muldi3, .{ .name = "__muldi3", .linkage = linkage }); 419 const __divmoddi4 = @import("compiler_rt/int.zig").__divmoddi4; 420 @export(__divmoddi4, .{ .name = "__divmoddi4", .linkage = linkage }); 421 const __divsi3 = @import("compiler_rt/int.zig").__divsi3; 422 @export(__divsi3, .{ .name = "__divsi3", .linkage = linkage }); 423 const __divdi3 = @import("compiler_rt/int.zig").__divdi3; 424 @export(__divdi3, .{ .name = "__divdi3", .linkage = linkage }); 425 const __udivsi3 = @import("compiler_rt/int.zig").__udivsi3; 426 @export(__udivsi3, .{ .name = "__udivsi3", .linkage = linkage }); 427 const __udivdi3 = @import("compiler_rt/int.zig").__udivdi3; 428 @export(__udivdi3, .{ .name = "__udivdi3", .linkage = linkage }); 429 const __modsi3 = @import("compiler_rt/int.zig").__modsi3; 430 @export(__modsi3, .{ .name = "__modsi3", .linkage = linkage }); 431 const __moddi3 = @import("compiler_rt/int.zig").__moddi3; 432 @export(__moddi3, .{ .name = "__moddi3", .linkage = linkage }); 433 const __umodsi3 = @import("compiler_rt/int.zig").__umodsi3; 434 @export(__umodsi3, .{ .name = "__umodsi3", .linkage = linkage }); 435 const __umoddi3 = @import("compiler_rt/int.zig").__umoddi3; 436 @export(__umoddi3, .{ .name = "__umoddi3", .linkage = linkage }); 437 const __divmodsi4 = @import("compiler_rt/int.zig").__divmodsi4; 438 @export(__divmodsi4, .{ .name = "__divmodsi4", .linkage = linkage }); 439 const __udivmodsi4 = @import("compiler_rt/int.zig").__udivmodsi4; 440 @export(__udivmodsi4, .{ .name = "__udivmodsi4", .linkage = linkage }); 441 442 // Integer Arithmetic with trapping overflow 443 const __absvsi2 = @import("compiler_rt/absv.zig").__absvsi2; 444 @export(__absvsi2, .{ .name = "__absvsi2", .linkage = linkage }); 445 const __absvdi2 = @import("compiler_rt/absv.zig").__absvdi2; 446 @export(__absvdi2, .{ .name = "__absvdi2", .linkage = linkage }); 447 const __absvti2 = @import("compiler_rt/absv.zig").__absvti2; 448 @export(__absvti2, .{ .name = "__absvti2", .linkage = linkage }); 449 const __negvsi2 = @import("compiler_rt/negv.zig").__negvsi2; 450 @export(__negvsi2, .{ .name = "__negvsi2", .linkage = linkage }); 451 const __negvdi2 = @import("compiler_rt/negv.zig").__negvdi2; 452 @export(__negvdi2, .{ .name = "__negvdi2", .linkage = linkage }); 453 const __negvti2 = @import("compiler_rt/negv.zig").__negvti2; 454 @export(__negvti2, .{ .name = "__negvti2", .linkage = linkage }); 455 456 // Integer arithmetic which returns if overflow 457 const __addosi4 = @import("compiler_rt/addo.zig").__addosi4; 458 @export(__addosi4, .{ .name = "__addosi4", .linkage = linkage }); 459 const __addodi4 = @import("compiler_rt/addo.zig").__addodi4; 460 @export(__addodi4, .{ .name = "__addodi4", .linkage = linkage }); 461 const __addoti4 = @import("compiler_rt/addo.zig").__addoti4; 462 @export(__addoti4, .{ .name = "__addoti4", .linkage = linkage }); 463 const __subosi4 = @import("compiler_rt/subo.zig").__subosi4; 464 @export(__subosi4, .{ .name = "__subosi4", .linkage = linkage }); 465 const __subodi4 = @import("compiler_rt/subo.zig").__subodi4; 466 @export(__subodi4, .{ .name = "__subodi4", .linkage = linkage }); 467 const __suboti4 = @import("compiler_rt/subo.zig").__suboti4; 468 @export(__suboti4, .{ .name = "__suboti4", .linkage = linkage }); 469 const __mulosi4 = @import("compiler_rt/mulo.zig").__mulosi4; 470 @export(__mulosi4, .{ .name = "__mulosi4", .linkage = linkage }); 471 const __mulodi4 = @import("compiler_rt/mulo.zig").__mulodi4; 472 @export(__mulodi4, .{ .name = "__mulodi4", .linkage = linkage }); 473 const __muloti4 = @import("compiler_rt/mulo.zig").__muloti4; 474 @export(__muloti4, .{ .name = "__muloti4", .linkage = linkage }); 475 476 // Integer Comparison 477 // (a < b) => 0 478 // (a == b) => 1 479 // (a > b) => 2 480 const __cmpsi2 = @import("compiler_rt/cmp.zig").__cmpsi2; 481 @export(__cmpsi2, .{ .name = "__cmpsi2", .linkage = linkage }); 482 const __cmpdi2 = @import("compiler_rt/cmp.zig").__cmpdi2; 483 @export(__cmpdi2, .{ .name = "__cmpdi2", .linkage = linkage }); 484 const __cmpti2 = @import("compiler_rt/cmp.zig").__cmpti2; 485 @export(__cmpti2, .{ .name = "__cmpti2", .linkage = linkage }); 486 const __ucmpsi2 = @import("compiler_rt/cmp.zig").__ucmpsi2; 487 @export(__ucmpsi2, .{ .name = "__ucmpsi2", .linkage = linkage }); 488 const __ucmpdi2 = @import("compiler_rt/cmp.zig").__ucmpdi2; 489 @export(__ucmpdi2, .{ .name = "__ucmpdi2", .linkage = linkage }); 490 const __ucmpti2 = @import("compiler_rt/cmp.zig").__ucmpti2; 491 @export(__ucmpti2, .{ .name = "__ucmpti2", .linkage = linkage }); 492 493 // missing: Floating point raised to integer power 494 495 // missing: Complex arithmetic 496 // (a + ib) * (c + id) 497 // (a + ib) / (c + id) 498 499 const __negsf2 = @import("compiler_rt/negXf2.zig").__negsf2; 500 @export(__negsf2, .{ .name = "__negsf2", .linkage = linkage }); 501 const __negdf2 = @import("compiler_rt/negXf2.zig").__negdf2; 502 @export(__negdf2, .{ .name = "__negdf2", .linkage = linkage }); 503 504 if (builtin.link_libc and os_tag == .openbsd) { 505 const __emutls_get_address = @import("compiler_rt/emutls.zig").__emutls_get_address; 506 @export(__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = linkage }); 507 } 508 509 if ((arch.isARM() or arch.isThumb()) and !is_test) { 510 const __aeabi_unwind_cpp_pr0 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr0; 511 @export(__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = linkage }); 512 const __aeabi_unwind_cpp_pr1 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr1; 513 @export(__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = linkage }); 514 const __aeabi_unwind_cpp_pr2 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr2; 515 @export(__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = linkage }); 516 517 @export(__muldi3, .{ .name = "__aeabi_lmul", .linkage = linkage }); 518 519 const __aeabi_ldivmod = @import("compiler_rt/arm.zig").__aeabi_ldivmod; 520 @export(__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = linkage }); 521 const __aeabi_uldivmod = @import("compiler_rt/arm.zig").__aeabi_uldivmod; 522 @export(__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = linkage }); 523 524 @export(__divsi3, .{ .name = "__aeabi_idiv", .linkage = linkage }); 525 const __aeabi_idivmod = @import("compiler_rt/arm.zig").__aeabi_idivmod; 526 @export(__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = linkage }); 527 @export(__udivsi3, .{ .name = "__aeabi_uidiv", .linkage = linkage }); 528 const __aeabi_uidivmod = @import("compiler_rt/arm.zig").__aeabi_uidivmod; 529 @export(__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = linkage }); 530 531 const __aeabi_memcpy = @import("compiler_rt/arm.zig").__aeabi_memcpy; 532 @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = linkage }); 533 @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy4", .linkage = linkage }); 534 @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy8", .linkage = linkage }); 535 536 const __aeabi_memmove = @import("compiler_rt/arm.zig").__aeabi_memmove; 537 @export(__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = linkage }); 538 @export(__aeabi_memmove, .{ .name = "__aeabi_memmove4", .linkage = linkage }); 539 @export(__aeabi_memmove, .{ .name = "__aeabi_memmove8", .linkage = linkage }); 540 541 const __aeabi_memset = @import("compiler_rt/arm.zig").__aeabi_memset; 542 @export(__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = linkage }); 543 @export(__aeabi_memset, .{ .name = "__aeabi_memset4", .linkage = linkage }); 544 @export(__aeabi_memset, .{ .name = "__aeabi_memset8", .linkage = linkage }); 545 546 const __aeabi_memclr = @import("compiler_rt/arm.zig").__aeabi_memclr; 547 @export(__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = linkage }); 548 @export(__aeabi_memclr, .{ .name = "__aeabi_memclr4", .linkage = linkage }); 549 @export(__aeabi_memclr, .{ .name = "__aeabi_memclr8", .linkage = linkage }); 550 551 if (os_tag == .linux) { 552 const __aeabi_read_tp = @import("compiler_rt/arm.zig").__aeabi_read_tp; 553 @export(__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = linkage }); 554 } 555 556 const __aeabi_f2d = @import("compiler_rt/extendXfYf2.zig").__aeabi_f2d; 557 @export(__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = linkage }); 558 const __aeabi_i2d = @import("compiler_rt/floatsiXf.zig").__aeabi_i2d; 559 @export(__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = linkage }); 560 const __aeabi_l2d = @import("compiler_rt/floatdidf.zig").__aeabi_l2d; 561 @export(__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = linkage }); 562 const __aeabi_l2f = @import("compiler_rt/floatXisf.zig").__aeabi_l2f; 563 @export(__aeabi_l2f, .{ .name = "__aeabi_l2f", .linkage = linkage }); 564 const __aeabi_ui2d = @import("compiler_rt/floatunsidf.zig").__aeabi_ui2d; 565 @export(__aeabi_ui2d, .{ .name = "__aeabi_ui2d", .linkage = linkage }); 566 const __aeabi_ul2d = @import("compiler_rt/floatundidf.zig").__aeabi_ul2d; 567 @export(__aeabi_ul2d, .{ .name = "__aeabi_ul2d", .linkage = linkage }); 568 const __aeabi_ui2f = @import("compiler_rt/floatunsisf.zig").__aeabi_ui2f; 569 @export(__aeabi_ui2f, .{ .name = "__aeabi_ui2f", .linkage = linkage }); 570 const __aeabi_ul2f = @import("compiler_rt/floatundisf.zig").__aeabi_ul2f; 571 @export(__aeabi_ul2f, .{ .name = "__aeabi_ul2f", .linkage = linkage }); 572 573 const __aeabi_fneg = @import("compiler_rt/negXf2.zig").__aeabi_fneg; 574 @export(__aeabi_fneg, .{ .name = "__aeabi_fneg", .linkage = linkage }); 575 const __aeabi_dneg = @import("compiler_rt/negXf2.zig").__aeabi_dneg; 576 @export(__aeabi_dneg, .{ .name = "__aeabi_dneg", .linkage = linkage }); 577 578 const __aeabi_fmul = @import("compiler_rt/mulXf3.zig").__aeabi_fmul; 579 @export(__aeabi_fmul, .{ .name = "__aeabi_fmul", .linkage = linkage }); 580 const __aeabi_dmul = @import("compiler_rt/mulXf3.zig").__aeabi_dmul; 581 @export(__aeabi_dmul, .{ .name = "__aeabi_dmul", .linkage = linkage }); 582 583 const __aeabi_d2h = @import("compiler_rt/truncXfYf2.zig").__aeabi_d2h; 584 @export(__aeabi_d2h, .{ .name = "__aeabi_d2h", .linkage = linkage }); 585 586 const __aeabi_f2ulz = @import("compiler_rt/fixunssfdi.zig").__aeabi_f2ulz; 587 @export(__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = linkage }); 588 const __aeabi_d2ulz = @import("compiler_rt/fixunsdfdi.zig").__aeabi_d2ulz; 589 @export(__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = linkage }); 590 591 const __aeabi_f2lz = @import("compiler_rt/fixsfdi.zig").__aeabi_f2lz; 592 @export(__aeabi_f2lz, .{ .name = "__aeabi_f2lz", .linkage = linkage }); 593 const __aeabi_d2lz = @import("compiler_rt/fixdfdi.zig").__aeabi_d2lz; 594 @export(__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = linkage }); 595 596 const __aeabi_d2uiz = @import("compiler_rt/fixunsdfsi.zig").__aeabi_d2uiz; 597 @export(__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = linkage }); 598 599 const __aeabi_h2f = @import("compiler_rt/extendXfYf2.zig").__aeabi_h2f; 600 @export(__aeabi_h2f, .{ .name = "__aeabi_h2f", .linkage = linkage }); 601 const __aeabi_f2h = @import("compiler_rt/truncXfYf2.zig").__aeabi_f2h; 602 @export(__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = linkage }); 603 604 const __aeabi_i2f = @import("compiler_rt/floatsiXf.zig").__aeabi_i2f; 605 @export(__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = linkage }); 606 const __aeabi_d2f = @import("compiler_rt/truncXfYf2.zig").__aeabi_d2f; 607 @export(__aeabi_d2f, .{ .name = "__aeabi_d2f", .linkage = linkage }); 608 609 const __aeabi_fadd = @import("compiler_rt/addXf3.zig").__aeabi_fadd; 610 @export(__aeabi_fadd, .{ .name = "__aeabi_fadd", .linkage = linkage }); 611 const __aeabi_dadd = @import("compiler_rt/addXf3.zig").__aeabi_dadd; 612 @export(__aeabi_dadd, .{ .name = "__aeabi_dadd", .linkage = linkage }); 613 const __aeabi_fsub = @import("compiler_rt/addXf3.zig").__aeabi_fsub; 614 @export(__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = linkage }); 615 const __aeabi_dsub = @import("compiler_rt/addXf3.zig").__aeabi_dsub; 616 @export(__aeabi_dsub, .{ .name = "__aeabi_dsub", .linkage = linkage }); 617 618 const __aeabi_f2uiz = @import("compiler_rt/fixunssfsi.zig").__aeabi_f2uiz; 619 @export(__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = linkage }); 620 621 const __aeabi_f2iz = @import("compiler_rt/fixsfsi.zig").__aeabi_f2iz; 622 @export(__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = linkage }); 623 const __aeabi_d2iz = @import("compiler_rt/fixdfsi.zig").__aeabi_d2iz; 624 @export(__aeabi_d2iz, .{ .name = "__aeabi_d2iz", .linkage = linkage }); 625 626 const __aeabi_fdiv = @import("compiler_rt/divsf3.zig").__aeabi_fdiv; 627 @export(__aeabi_fdiv, .{ .name = "__aeabi_fdiv", .linkage = linkage }); 628 const __aeabi_ddiv = @import("compiler_rt/divdf3.zig").__aeabi_ddiv; 629 @export(__aeabi_ddiv, .{ .name = "__aeabi_ddiv", .linkage = linkage }); 630 631 const __aeabi_llsl = @import("compiler_rt/shift.zig").__aeabi_llsl; 632 @export(__aeabi_llsl, .{ .name = "__aeabi_llsl", .linkage = linkage }); 633 const __aeabi_lasr = @import("compiler_rt/shift.zig").__aeabi_lasr; 634 @export(__aeabi_lasr, .{ .name = "__aeabi_lasr", .linkage = linkage }); 635 const __aeabi_llsr = @import("compiler_rt/shift.zig").__aeabi_llsr; 636 @export(__aeabi_llsr, .{ .name = "__aeabi_llsr", .linkage = linkage }); 637 638 const __aeabi_fcmpeq = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpeq; 639 @export(__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = linkage }); 640 const __aeabi_fcmplt = @import("compiler_rt/compareXf2.zig").__aeabi_fcmplt; 641 @export(__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = linkage }); 642 const __aeabi_fcmple = @import("compiler_rt/compareXf2.zig").__aeabi_fcmple; 643 @export(__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = linkage }); 644 const __aeabi_fcmpge = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpge; 645 @export(__aeabi_fcmpge, .{ .name = "__aeabi_fcmpge", .linkage = linkage }); 646 const __aeabi_fcmpgt = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpgt; 647 @export(__aeabi_fcmpgt, .{ .name = "__aeabi_fcmpgt", .linkage = linkage }); 648 const __aeabi_fcmpun = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpun; 649 @export(__aeabi_fcmpun, .{ .name = "__aeabi_fcmpun", .linkage = linkage }); 650 651 const __aeabi_dcmpeq = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpeq; 652 @export(__aeabi_dcmpeq, .{ .name = "__aeabi_dcmpeq", .linkage = linkage }); 653 const __aeabi_dcmplt = @import("compiler_rt/compareXf2.zig").__aeabi_dcmplt; 654 @export(__aeabi_dcmplt, .{ .name = "__aeabi_dcmplt", .linkage = linkage }); 655 const __aeabi_dcmple = @import("compiler_rt/compareXf2.zig").__aeabi_dcmple; 656 @export(__aeabi_dcmple, .{ .name = "__aeabi_dcmple", .linkage = linkage }); 657 const __aeabi_dcmpge = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpge; 658 @export(__aeabi_dcmpge, .{ .name = "__aeabi_dcmpge", .linkage = linkage }); 659 const __aeabi_dcmpgt = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpgt; 660 @export(__aeabi_dcmpgt, .{ .name = "__aeabi_dcmpgt", .linkage = linkage }); 661 const __aeabi_dcmpun = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpun; 662 @export(__aeabi_dcmpun, .{ .name = "__aeabi_dcmpun", .linkage = linkage }); 663 } 664 665 if (arch == .i386 and abi == .msvc) { 666 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins 667 const _alldiv = @import("compiler_rt/aulldiv.zig")._alldiv; 668 @export(_alldiv, .{ .name = "\x01__alldiv", .linkage = strong_linkage }); 669 const _aulldiv = @import("compiler_rt/aulldiv.zig")._aulldiv; 670 @export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = strong_linkage }); 671 const _allrem = @import("compiler_rt/aullrem.zig")._allrem; 672 @export(_allrem, .{ .name = "\x01__allrem", .linkage = strong_linkage }); 673 const _aullrem = @import("compiler_rt/aullrem.zig")._aullrem; 674 @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage }); 675 } 676 677 if (arch.isSPARC()) { 678 // SPARC systems use a different naming scheme 679 const _Qp_add = @import("compiler_rt/sparc.zig")._Qp_add; 680 @export(_Qp_add, .{ .name = "_Qp_add", .linkage = linkage }); 681 const _Qp_div = @import("compiler_rt/sparc.zig")._Qp_div; 682 @export(_Qp_div, .{ .name = "_Qp_div", .linkage = linkage }); 683 const _Qp_mul = @import("compiler_rt/sparc.zig")._Qp_mul; 684 @export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = linkage }); 685 const _Qp_sub = @import("compiler_rt/sparc.zig")._Qp_sub; 686 @export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = linkage }); 687 688 const _Qp_cmp = @import("compiler_rt/sparc.zig")._Qp_cmp; 689 @export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = linkage }); 690 const _Qp_feq = @import("compiler_rt/sparc.zig")._Qp_feq; 691 @export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = linkage }); 692 const _Qp_fne = @import("compiler_rt/sparc.zig")._Qp_fne; 693 @export(_Qp_fne, .{ .name = "_Qp_fne", .linkage = linkage }); 694 const _Qp_flt = @import("compiler_rt/sparc.zig")._Qp_flt; 695 @export(_Qp_flt, .{ .name = "_Qp_flt", .linkage = linkage }); 696 const _Qp_fle = @import("compiler_rt/sparc.zig")._Qp_fle; 697 @export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = linkage }); 698 const _Qp_fgt = @import("compiler_rt/sparc.zig")._Qp_fgt; 699 @export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = linkage }); 700 const _Qp_fge = @import("compiler_rt/sparc.zig")._Qp_fge; 701 @export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = linkage }); 702 703 const _Qp_itoq = @import("compiler_rt/sparc.zig")._Qp_itoq; 704 @export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = linkage }); 705 const _Qp_uitoq = @import("compiler_rt/sparc.zig")._Qp_uitoq; 706 @export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = linkage }); 707 const _Qp_xtoq = @import("compiler_rt/sparc.zig")._Qp_xtoq; 708 @export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = linkage }); 709 const _Qp_uxtoq = @import("compiler_rt/sparc.zig")._Qp_uxtoq; 710 @export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = linkage }); 711 const _Qp_stoq = @import("compiler_rt/sparc.zig")._Qp_stoq; 712 @export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = linkage }); 713 const _Qp_dtoq = @import("compiler_rt/sparc.zig")._Qp_dtoq; 714 @export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = linkage }); 715 const _Qp_qtoi = @import("compiler_rt/sparc.zig")._Qp_qtoi; 716 @export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = linkage }); 717 const _Qp_qtoui = @import("compiler_rt/sparc.zig")._Qp_qtoui; 718 @export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = linkage }); 719 const _Qp_qtox = @import("compiler_rt/sparc.zig")._Qp_qtox; 720 @export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = linkage }); 721 const _Qp_qtoux = @import("compiler_rt/sparc.zig")._Qp_qtoux; 722 @export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = linkage }); 723 const _Qp_qtos = @import("compiler_rt/sparc.zig")._Qp_qtos; 724 @export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = linkage }); 725 const _Qp_qtod = @import("compiler_rt/sparc.zig")._Qp_qtod; 726 @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage }); 727 } 728 729 if ((arch == .powerpc or arch.isPPC64()) and !is_test) { 730 @export(__addtf3, .{ .name = "__addkf3", .linkage = linkage }); 731 @export(__subtf3, .{ .name = "__subkf3", .linkage = linkage }); 732 @export(__multf3, .{ .name = "__mulkf3", .linkage = linkage }); 733 @export(__divtf3, .{ .name = "__divkf3", .linkage = linkage }); 734 @export(__extendsftf2, .{ .name = "__extendsfkf2", .linkage = linkage }); 735 @export(__extenddftf2, .{ .name = "__extenddfkf2", .linkage = linkage }); 736 @export(__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = linkage }); 737 @export(__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = linkage }); 738 @export(__fixtfdi, .{ .name = "__fixkfdi", .linkage = linkage }); 739 @export(__fixtfsi, .{ .name = "__fixkfsi", .linkage = linkage }); 740 @export(__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = linkage }); 741 @export(__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = linkage }); 742 @export(__floatsitf, .{ .name = "__floatsikf", .linkage = linkage }); 743 @export(__floatditf, .{ .name = "__floatdikf", .linkage = linkage }); 744 @export(__floatunditf, .{ .name = "__floatundikf", .linkage = linkage }); 745 @export(__floatunsitf, .{ .name = "__floatunsikf", .linkage = linkage }); 746 747 @export(__letf2, .{ .name = "__eqkf2", .linkage = linkage }); 748 @export(__letf2, .{ .name = "__nekf2", .linkage = linkage }); 749 @export(__getf2, .{ .name = "__gekf2", .linkage = linkage }); 750 @export(__letf2, .{ .name = "__ltkf2", .linkage = linkage }); 751 @export(__letf2, .{ .name = "__lekf2", .linkage = linkage }); 752 @export(__getf2, .{ .name = "__gtkf2", .linkage = linkage }); 753 @export(__unordtf2, .{ .name = "__unordkf2", .linkage = linkage }); 754 } 755 756 const fmodl = @import("compiler_rt/floatfmodl.zig").fmodl; 757 @export(fmodl, .{ .name = "fmodl", .linkage = linkage }); 758 759 @export(floorf, .{ .name = "floorf", .linkage = linkage }); 760 @export(floor, .{ .name = "floor", .linkage = linkage }); 761 @export(floorl, .{ .name = "floorl", .linkage = linkage }); 762 763 @export(fma, .{ .name = "fma", .linkage = linkage }); 764 @export(fmaf, .{ .name = "fmaf", .linkage = linkage }); 765 @export(fmal, .{ .name = "fmal", .linkage = linkage }); 766 if (!long_double_is_f80) { 767 @export(__fmax, .{ .name = "__fmax", .linkage = linkage }); 768 } 769 if (!long_double_is_f128) { 770 @export(fmaq, .{ .name = "fmaq", .linkage = linkage }); 771 } 772 } 773 774 const math = std.math; 775 776 fn fmaf(a: f32, b: f32, c: f32) callconv(.C) f32 { 777 return math.fma(f32, a, b, c); 778 } 779 fn fma(a: f64, b: f64, c: f64) callconv(.C) f64 { 780 return math.fma(f64, a, b, c); 781 } 782 fn __fmax(a: f80, b: f80, c: f80) callconv(.C) f80 { 783 return math.fma(f80, a, b, c); 784 } 785 fn fmaq(a: f128, b: f128, c: f128) callconv(.C) f128 { 786 return math.fma(f128, a, b, c); 787 } 788 fn fmal(a: c_longdouble, b: c_longdouble, c: c_longdouble) callconv(.C) c_longdouble { 789 return math.fma(c_longdouble, a, b, c); 790 } 791 792 // TODO add intrinsics for these (and probably the double version too) 793 // and have the math stuff use the intrinsic. same as @mod and @rem 794 fn floorf(x: f32) callconv(.C) f32 { 795 return math.floor(x); 796 } 797 fn floor(x: f64) callconv(.C) f64 { 798 return math.floor(x); 799 } 800 fn floorl(x: c_longdouble) callconv(.C) c_longdouble { 801 if (!long_double_is_f128) { 802 @panic("TODO implement this"); 803 } 804 return math.floor(x); 805 } 806 807 // Avoid dragging in the runtime safety mechanisms into this .o file, 808 // unless we're trying to test this file. 809 pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { 810 _ = error_return_trace; 811 @setCold(true); 812 if (is_test) { 813 std.debug.panic("{s}", .{msg}); 814 } else { 815 unreachable; 816 } 817 }