Commit 5feb27c126

Jacob Young <jacobly0@users.noreply.github.com>
2023-04-22 01:08:43
zig.h: fix float negation
1 parent d56c6c7
Changed files (2)
lib
src
codegen
lib/zig.h
@@ -434,24 +434,24 @@ typedef ptrdiff_t intptr_t;
 #define zig_minInt_u(w, bits) zig_intLimit(u, w, min, bits)
 #define zig_maxInt_u(w, bits) zig_intLimit(u, w, max, bits)
 
-#define zig_int_operator(Type, RhsType, operation, operator) \
+#define zig_operator(Type, RhsType, operation, operator) \
     static inline Type zig_##operation(Type lhs, RhsType rhs) { \
         return lhs operator rhs; \
     }
-#define zig_int_basic_operator(Type, operation, operator) \
-    zig_int_operator(Type,    Type, operation, operator)
-#define zig_int_shift_operator(Type, operation, operator) \
-    zig_int_operator(Type, uint8_t, operation, operator)
+#define zig_basic_operator(Type, operation, operator) \
+    zig_operator(Type,    Type, operation, operator)
+#define zig_shift_operator(Type, operation, operator) \
+    zig_operator(Type, uint8_t, operation, operator)
 #define zig_int_helpers(w) \
-    zig_int_basic_operator(uint##w##_t, and_u##w,  &) \
-    zig_int_basic_operator( int##w##_t, and_i##w,  &) \
-    zig_int_basic_operator(uint##w##_t,  or_u##w,  |) \
-    zig_int_basic_operator( int##w##_t,  or_i##w,  |) \
-    zig_int_basic_operator(uint##w##_t, xor_u##w,  ^) \
-    zig_int_basic_operator( int##w##_t, xor_i##w,  ^) \
-    zig_int_shift_operator(uint##w##_t, shl_u##w, <<) \
-    zig_int_shift_operator( int##w##_t, shl_i##w, <<) \
-    zig_int_shift_operator(uint##w##_t, shr_u##w, >>) \
+    zig_basic_operator(uint##w##_t, and_u##w,  &) \
+    zig_basic_operator( int##w##_t, and_i##w,  &) \
+    zig_basic_operator(uint##w##_t,  or_u##w,  |) \
+    zig_basic_operator( int##w##_t,  or_i##w,  |) \
+    zig_basic_operator(uint##w##_t, xor_u##w,  ^) \
+    zig_basic_operator( int##w##_t, xor_i##w,  ^) \
+    zig_shift_operator(uint##w##_t, shl_u##w, <<) \
+    zig_shift_operator( int##w##_t, shl_i##w, <<) \
+    zig_shift_operator(uint##w##_t, shr_u##w, >>) \
 \
     static inline int##w##_t zig_shr_i##w(int##w##_t lhs, uint8_t rhs) { \
         int##w##_t sign_mask = lhs < INT##w##_C(0) ? -INT##w##_C(1) : INT##w##_C(0); \
@@ -476,13 +476,13 @@ typedef ptrdiff_t intptr_t;
             ? val | zig_minInt_i(w, bits) : val & zig_maxInt_i(w, bits); \
     } \
 \
-    zig_int_basic_operator(uint##w##_t, div_floor_u##w, /) \
+    zig_basic_operator(uint##w##_t, div_floor_u##w, /) \
 \
     static inline int##w##_t zig_div_floor_i##w(int##w##_t lhs, int##w##_t rhs) { \
         return lhs / rhs - (((lhs ^ rhs) & (lhs % rhs)) < INT##w##_C(0)); \
     } \
 \
-    zig_int_basic_operator(uint##w##_t, mod_u##w, %) \
+    zig_basic_operator(uint##w##_t, mod_u##w, %) \
 \
     static inline int##w##_t zig_mod_i##w(int##w##_t lhs, int##w##_t rhs) { \
         int##w##_t rem = lhs % rhs; \
@@ -1153,8 +1153,8 @@ typedef   signed __int128 zig_i128;
 #define zig_lo_u128(val) ((uint64_t)((val) >>  0))
 #define zig_hi_i128(val) (( int64_t)((val) >> 64))
 #define zig_lo_i128(val) ((uint64_t)((val) >>  0))
-#define zig_bitcast_u128(val) ((zig_u128)(val))
-#define zig_bitcast_i128(val) ((zig_i128)(val))
+#define zig_bitCast_u128(val) ((zig_u128)(val))
+#define zig_bitCast_i128(val) ((zig_i128)(val))
 #define zig_cmp_int128(Type) \
     static inline int32_t zig_cmp_##Type(zig_##Type lhs, zig_##Type rhs) { \
         return (lhs > rhs) - (lhs < rhs); \
@@ -1188,8 +1188,8 @@ typedef struct { zig_align(16) int64_t hi; uint64_t lo; } zig_i128;
 #define zig_lo_u128(val) ((val).lo)
 #define zig_hi_i128(val) ((val).hi)
 #define zig_lo_i128(val) ((val).lo)
-#define zig_bitcast_u128(val) zig_make_u128((uint64_t)(val).hi, (val).lo)
-#define zig_bitcast_i128(val) zig_make_i128(( int64_t)(val).hi, (val).lo)
+#define zig_bitCast_u128(val) zig_make_u128((uint64_t)(val).hi, (val).lo)
+#define zig_bitCast_i128(val) zig_make_i128(( int64_t)(val).hi, (val).lo)
 #define zig_cmp_int128(Type) \
     static inline int32_t zig_cmp_##Type(zig_##Type lhs, zig_##Type rhs) { \
         return (lhs.hi == rhs.hi) \
@@ -1363,7 +1363,7 @@ static zig_i128 zig_mul_i128(zig_i128 lhs, zig_i128 rhs) {
 }
 
 static zig_u128 zig_mul_u128(zig_u128 lhs, zig_u128 rhs) {
-    return zig_bitcast_u128(zig_mul_i128(zig_bitcast_i128(lhs), zig_bitcast_i128(rhs)));
+    return zig_bitCast_u128(zig_mul_i128(zig_bitCast_i128(lhs), zig_bitCast_i128(rhs)));
 }
 
 zig_extern zig_u128 __udivti3(zig_u128 lhs, zig_u128 rhs);
@@ -1431,7 +1431,7 @@ static inline zig_u128 zig_shlw_u128(zig_u128 lhs, uint8_t rhs, uint8_t bits) {
 }
 
 static inline zig_i128 zig_shlw_i128(zig_i128 lhs, uint8_t rhs, uint8_t bits) {
-    return zig_wrap_i128(zig_bitcast_i128(zig_shl_u128(zig_bitcast_u128(lhs), rhs)), bits);
+    return zig_wrap_i128(zig_bitCast_i128(zig_shl_u128(zig_bitCast_u128(lhs), rhs)), bits);
 }
 
 static inline zig_u128 zig_addw_u128(zig_u128 lhs, zig_u128 rhs, uint8_t bits) {
@@ -1439,7 +1439,7 @@ static inline zig_u128 zig_addw_u128(zig_u128 lhs, zig_u128 rhs, uint8_t bits) {
 }
 
 static inline zig_i128 zig_addw_i128(zig_i128 lhs, zig_i128 rhs, uint8_t bits) {
-    return zig_wrap_i128(zig_bitcast_i128(zig_add_u128(zig_bitcast_u128(lhs), zig_bitcast_u128(rhs))), bits);
+    return zig_wrap_i128(zig_bitCast_i128(zig_add_u128(zig_bitCast_u128(lhs), zig_bitCast_u128(rhs))), bits);
 }
 
 static inline zig_u128 zig_subw_u128(zig_u128 lhs, zig_u128 rhs, uint8_t bits) {
@@ -1447,7 +1447,7 @@ static inline zig_u128 zig_subw_u128(zig_u128 lhs, zig_u128 rhs, uint8_t bits) {
 }
 
 static inline zig_i128 zig_subw_i128(zig_i128 lhs, zig_i128 rhs, uint8_t bits) {
-    return zig_wrap_i128(zig_bitcast_i128(zig_sub_u128(zig_bitcast_u128(lhs), zig_bitcast_u128(rhs))), bits);
+    return zig_wrap_i128(zig_bitCast_i128(zig_sub_u128(zig_bitCast_u128(lhs), zig_bitCast_u128(rhs))), bits);
 }
 
 static inline zig_u128 zig_mulw_u128(zig_u128 lhs, zig_u128 rhs, uint8_t bits) {
@@ -1455,7 +1455,7 @@ static inline zig_u128 zig_mulw_u128(zig_u128 lhs, zig_u128 rhs, uint8_t bits) {
 }
 
 static inline zig_i128 zig_mulw_i128(zig_i128 lhs, zig_i128 rhs, uint8_t bits) {
-    return zig_wrap_i128(zig_bitcast_i128(zig_mul_u128(zig_bitcast_u128(lhs), zig_bitcast_u128(rhs))), bits);
+    return zig_wrap_i128(zig_bitCast_i128(zig_mul_u128(zig_bitCast_u128(lhs), zig_bitCast_u128(rhs))), bits);
 }
 
 #if zig_has_int128
@@ -1590,7 +1590,7 @@ static inline bool zig_shlo_u128(zig_u128 *res, zig_u128 lhs, uint8_t rhs, uint8
 
 static inline bool zig_shlo_i128(zig_i128 *res, zig_i128 lhs, uint8_t rhs, uint8_t bits) {
     *res = zig_shlw_i128(lhs, rhs, bits);
-    zig_i128 mask = zig_bitcast_i128(zig_shl_u128(zig_maxInt_u128, bits - rhs - UINT8_C(1)));
+    zig_i128 mask = zig_bitCast_i128(zig_shl_u128(zig_maxInt_u128, bits - rhs - UINT8_C(1)));
     return zig_cmp_i128(zig_and_i128(lhs, mask), zig_make_i128(0, 0)) != INT32_C(0) &&
            zig_cmp_i128(zig_and_i128(lhs, mask), mask) != INT32_C(0);
 }
@@ -1604,7 +1604,7 @@ static inline zig_u128 zig_shls_u128(zig_u128 lhs, zig_u128 rhs, uint8_t bits) {
 
 static inline zig_i128 zig_shls_i128(zig_i128 lhs, zig_i128 rhs, uint8_t bits) {
     zig_i128 res;
-    if (zig_cmp_u128(zig_bitcast_u128(rhs), zig_make_u128(0, bits)) < INT32_C(0) && !zig_shlo_i128(&res, lhs, (uint8_t)zig_lo_i128(rhs), bits)) return res;
+    if (zig_cmp_u128(zig_bitCast_u128(rhs), zig_make_u128(0, bits)) < INT32_C(0) && !zig_shlo_i128(&res, lhs, (uint8_t)zig_lo_i128(rhs), bits)) return res;
     return zig_cmp_i128(lhs, zig_make_i128(0, 0)) < INT32_C(0) ? zig_minInt_i(128, bits) : zig_maxInt_i(128, bits);
 }
 
@@ -1648,7 +1648,7 @@ static inline uint8_t zig_clz_u128(zig_u128 val, uint8_t bits) {
 }
 
 static inline uint8_t zig_clz_i128(zig_i128 val, uint8_t bits) {
-    return zig_clz_u128(zig_bitcast_u128(val), bits);
+    return zig_clz_u128(zig_bitCast_u128(val), bits);
 }
 
 static inline uint8_t zig_ctz_u128(zig_u128 val, uint8_t bits) {
@@ -1657,7 +1657,7 @@ static inline uint8_t zig_ctz_u128(zig_u128 val, uint8_t bits) {
 }
 
 static inline uint8_t zig_ctz_i128(zig_i128 val, uint8_t bits) {
-    return zig_ctz_u128(zig_bitcast_u128(val), bits);
+    return zig_ctz_u128(zig_bitCast_u128(val), bits);
 }
 
 static inline uint8_t zig_popcount_u128(zig_u128 val, uint8_t bits) {
@@ -1666,7 +1666,7 @@ static inline uint8_t zig_popcount_u128(zig_u128 val, uint8_t bits) {
 }
 
 static inline uint8_t zig_popcount_i128(zig_i128 val, uint8_t bits) {
-    return zig_popcount_u128(zig_bitcast_u128(val), bits);
+    return zig_popcount_u128(zig_bitCast_u128(val), bits);
 }
 
 static inline zig_u128 zig_byte_swap_u128(zig_u128 val, uint8_t bits) {
@@ -1681,7 +1681,7 @@ static inline zig_u128 zig_byte_swap_u128(zig_u128 val, uint8_t bits) {
 }
 
 static inline zig_i128 zig_byte_swap_i128(zig_i128 val, uint8_t bits) {
-    return zig_bitcast_i128(zig_byte_swap_u128(zig_bitcast_u128(val), bits));
+    return zig_bitCast_i128(zig_byte_swap_u128(zig_bitCast_u128(val), bits));
 }
 
 static inline zig_u128 zig_bit_reverse_u128(zig_u128 val, uint8_t bits) {
@@ -1691,7 +1691,7 @@ static inline zig_u128 zig_bit_reverse_u128(zig_u128 val, uint8_t bits) {
 }
 
 static inline zig_i128 zig_bit_reverse_i128(zig_i128 val, uint8_t bits) {
-    return zig_bitcast_i128(zig_bit_reverse_u128(zig_bitcast_u128(val), bits));
+    return zig_bitCast_i128(zig_bit_reverse_u128(zig_bitCast_u128(val), bits));
 }
 
 /* ========================== Big Integer Support =========================== */
@@ -2957,24 +2957,20 @@ long double __cdecl nanl(char const* input);
 #endif
 
 #if (zig_has_builtin(nan) && zig_has_builtin(nans) && zig_has_builtin(inf)) || defined(zig_gnuc)
-#define zig_has_float_builtins 1
-#define zig_make_special_f16(sign, name, arg, repr) sign zig_make_f16(__builtin_##name, )(arg)
-#define zig_make_special_f32(sign, name, arg, repr) sign zig_make_f32(__builtin_##name, )(arg)
-#define zig_make_special_f64(sign, name, arg, repr) sign zig_make_f64(__builtin_##name, )(arg)
-#define zig_make_special_f80(sign, name, arg, repr) sign zig_make_f80(__builtin_##name, )(arg)
+#define  zig_make_special_f16(sign, name, arg, repr) sign zig_make_f16 (__builtin_##name, )(arg)
+#define  zig_make_special_f32(sign, name, arg, repr) sign zig_make_f32 (__builtin_##name, )(arg)
+#define  zig_make_special_f64(sign, name, arg, repr) sign zig_make_f64 (__builtin_##name, )(arg)
+#define  zig_make_special_f80(sign, name, arg, repr) sign zig_make_f80 (__builtin_##name, )(arg)
 #define zig_make_special_f128(sign, name, arg, repr) sign zig_make_f128(__builtin_##name, )(arg)
 #else
-#define zig_has_float_builtins 0
-#define zig_make_special_f16(sign, name, arg, repr) zig_float_from_repr_f16(repr)
-#define zig_make_special_f32(sign, name, arg, repr) zig_float_from_repr_f32(repr)
-#define zig_make_special_f64(sign, name, arg, repr) zig_float_from_repr_f64(repr)
-#define zig_make_special_f80(sign, name, arg, repr) zig_float_from_repr_f80(repr)
-#define zig_make_special_f128(sign, name, arg, repr)  zig_float_from_repr_f128(repr)
+#define  zig_make_special_f16(sign, name, arg, repr) zig_bitCast_f16 (repr)
+#define  zig_make_special_f32(sign, name, arg, repr) zig_bitCast_f32 (repr)
+#define  zig_make_special_f64(sign, name, arg, repr) zig_bitCast_f64 (repr)
+#define  zig_make_special_f80(sign, name, arg, repr) zig_bitCast_f80 (repr)
+#define zig_make_special_f128(sign, name, arg, repr) zig_bitCast_f128(repr)
 #endif
 
 #define zig_has_f16 1
-#define zig_bitSizeOf_f16 16
-typedef uint16_t zig_repr_f16;
 #define zig_libc_name_f16(name) __##name##h
 #define zig_init_special_f16(sign, name, arg, repr) zig_make_special_f16(sign, name, arg, repr)
 #if FLT_MANT_DIG == 11
@@ -2995,7 +2991,8 @@ typedef __fp16 zig_f16;
 #else
 #undef zig_has_f16
 #define zig_has_f16 0
-typedef zig_repr_f16 zig_f16;
+#define zig_repr_f16 u16
+typedef uint16_t zig_f16;
 #define zig_make_f16(fp, repr) repr
 #undef zig_make_special_f16
 #define zig_make_special_f16(sign, name, arg, repr) repr
@@ -3003,14 +3000,12 @@ typedef zig_repr_f16 zig_f16;
 #define zig_init_special_f16(sign, name, arg, repr) repr
 #endif
 #if __APPLE__ && (defined(__i386__) || defined(__x86_64__))
-typedef zig_repr_f16 zig_compiler_rt_f16;
+typedef uint16_t zig_compiler_rt_f16;
 #else
 typedef zig_f16 zig_compiler_rt_f16;
 #endif
 
 #define zig_has_f32 1
-#define zig_bitSizeOf_f32 32
-typedef uint32_t zig_repr_f32;
 #define zig_libc_name_f32(name) name##f
 #if _MSC_VER
 #define zig_init_special_f32(sign, name, arg, repr) sign zig_make_f32(zig_msvc_flt_##name, )
@@ -3032,7 +3027,8 @@ typedef _Float32 zig_f32;
 #else
 #undef zig_has_f32
 #define zig_has_f32 0
-typedef zig_repr_f32 zig_f32;
+#define zig_repr_f32 u32
+ypedef uint32_t zig_f32;
 #define zig_make_f32(fp, repr) repr
 #undef zig_make_special_f32
 #define zig_make_special_f32(sign, name, arg, repr) repr
@@ -3041,8 +3037,6 @@ typedef zig_repr_f32 zig_f32;
 #endif
 
 #define zig_has_f64 1
-#define zig_bitSizeOf_f64 64
-typedef uint64_t zig_repr_f64;
 #define zig_libc_name_f64(name) name
 #if _MSC_VER
 #define zig_init_special_f64(sign, name, arg, repr) sign zig_make_f64(zig_msvc_flt_##name, )
@@ -3067,7 +3061,8 @@ typedef _Float32x zig_f64;
 #else
 #undef zig_has_f64
 #define zig_has_f64 0
-typedef zig_repr_f64 zig_f64;
+#define zig_repr_f64 u64
+typedef uint64_t zig_f64;
 #define zig_make_f64(fp, repr) repr
 #undef zig_make_special_f64
 #define zig_make_special_f64(sign, name, arg, repr) repr
@@ -3076,8 +3071,6 @@ typedef zig_repr_f64 zig_f64;
 #endif
 
 #define zig_has_f80 1
-#define zig_bitSizeOf_f80 80
-typedef zig_u128 zig_repr_f80;
 #define zig_libc_name_f80(name) __##name##x
 #define zig_init_special_f80(sign, name, arg, repr) zig_make_special_f80(sign, name, arg, repr)
 #if FLT_MANT_DIG == 64
@@ -3101,7 +3094,8 @@ typedef __float80 zig_f80;
 #else
 #undef zig_has_f80
 #define zig_has_f80 0
-typedef zig_repr_f80 zig_f80;
+#define zig_repr_f80 u128
+typedef zig_u128 zig_f80;
 #define zig_make_f80(fp, repr) repr
 #undef zig_make_special_f80
 #define zig_make_special_f80(sign, name, arg, repr) repr
@@ -3110,8 +3104,6 @@ typedef zig_repr_f80 zig_f80;
 #endif
 
 #define zig_has_f128 1
-#define zig_bitSizeOf_f128 128
-typedef zig_u128 zig_repr_f128;
 #define zig_libc_name_f128(name) name##q
 #define zig_init_special_f128(sign, name, arg, repr) zig_make_special_f128(sign, name, arg, repr)
 #if FLT_MANT_DIG == 113
@@ -3140,14 +3132,18 @@ typedef __float128 zig_f128;
 #undef zig_make_special_f128
 #undef zig_init_special_f128
 #if __APPLE__ || defined(__aarch64__)
-typedef __attribute__((__vector_size__(16))) uint64_t zig_f128;
+typedef __attribute__((__vector_size__(2 * sizeof(uint64_t)))) uint64_t zig_v2u64;
+zig_basic_operator(zig_v2u64, xor_v2u64, ^)
+#define zig_repr_f128 v2u64
+typedef zig_v2u64 zig_f128;
 #define zig_make_f128_zig_make_u128(hi, lo) (zig_f128){ lo, hi }
 #define zig_make_f128_zig_init_u128 zig_make_f128_zig_make_u128
 #define zig_make_f128(fp, repr) zig_make_f128_##repr
 #define zig_make_special_f128(sign, name, arg, repr) zig_make_f128_##repr
 #define zig_init_special_f128(sign, name, arg, repr) zig_make_f128_##repr
 #else
-typedef zig_repr_f128 zig_f128;
+#define zig_repr_f128 u128
+typedef zig_u128 zig_f128;
 #define zig_make_f128(fp, repr) repr
 #define zig_make_special_f128(sign, name, arg, repr) repr
 #define zig_init_special_f128(sign, name, arg, repr) repr
@@ -3156,48 +3152,26 @@ typedef zig_repr_f128 zig_f128;
 
 #if !_MSC_VER && defined(ZIG_TARGET_ABI_MSVC)
 /* Emulate msvc abi on a gnu compiler */
-#define zig_bitSizeOf_c_longdouble 64
-typedef zig_repr_f64 zig_repr_c_longdouble;
 typedef zig_f64 zig_c_longdouble;
 #elif _MSC_VER && !defined(ZIG_TARGET_ABI_MSVC)
 /* Emulate gnu abi on an msvc compiler */
-#define zig_bitSizeOf_c_longdouble 128
-typedef zig_repr_f128 zig_repr_c_longdouble;
 typedef zig_f128 zig_c_longdouble;
 #else
-#if LDBL_MANT_DIG == 11
-#define zig_bitSizeOf_c_longdouble 16
-typedef zig_repr_f16 zig_repr_c_longdouble;
-#elif LDBL_MANT_DIG == 24
-#define zig_bitSizeOf_c_longdouble 32
-typedef zig_repr_f32 zig_repr_c_longdouble;
-#elif LDBL_MANT_DIG == 53
-#define zig_bitSizeOf_c_longdouble 64
-typedef zig_repr_f64 zig_repr_c_longdouble;
-#elif LDBL_MANT_DIG == 64
-#define zig_bitSizeOf_c_longdouble 80
-typedef zig_repr_f80 zig_repr_c_longdouble;
-#elif LDBL_MANT_DIG == 113
-#define zig_bitSizeOf_c_longdouble 128
-typedef zig_repr_f128 zig_repr_c_longdouble;
-#endif
+/* Target and compiler abi match */
 typedef long double zig_c_longdouble;
 #endif
 
-#if !zig_has_float_builtins
-#define zig_float_from_repr(Type) \
-    static inline zig_##Type zig_float_from_repr_##Type(zig_repr_##Type repr) { \
+#define zig_bitCast_float(Type, ReprType) \
+    static inline zig_##Type zig_bitCast_##Type(ReprType repr) { \
         zig_##Type result; \
         memcpy(&result, &repr, sizeof(result)); \
         return result; \
     }
-
-zig_float_from_repr(f16)
-zig_float_from_repr(f32)
-zig_float_from_repr(f64)
-zig_float_from_repr(f80)
-zig_float_from_repr(f128)
-#endif
+zig_bitCast_float(f16, uint16_t)
+zig_bitCast_float(f32, uint32_t)
+zig_bitCast_float(f64, uint64_t)
+zig_bitCast_float(f80, zig_u128)
+zig_bitCast_float(f128, zig_u128)
 
 #define zig_cast_f16 (zig_f16)
 #define zig_cast_f32 (zig_f32)
@@ -3246,17 +3220,18 @@ zig_convert_builtin(zig_f128,            zig_f128, extend, zig_f32,
 zig_convert_builtin(zig_f128,            zig_f128, extend, zig_f64,             zig_f64,  2)
 zig_convert_builtin(zig_f128,            zig_f128, extend, zig_f80,             zig_f80,  2)
 
-#define zig_float_negate_builtin_0(w, r, c, sb) zig_xor_u##r(arg, zig_make_f##w(-0x0.0p0, c sb))
-#define zig_float_negate_builtin_1(w, r, c, sb) -arg
-#define zig_float_negate_builtin(w, r, c, sb) \
+#define zig_float_negate_builtin_0(w, c, sb) \
+    zig_expand_concat(zig_xor_, zig_repr_f##w)(arg, zig_make_f##w(-0x0.0p0, c sb))
+#define zig_float_negate_builtin_1(w, c, sb) -arg
+#define zig_float_negate_builtin(w, c, sb) \
     static inline zig_f##w zig_neg_f##w(zig_f##w arg) { \
-        return zig_expand_concat(zig_float_negate_builtin_, zig_has_f##w)(w, r, c, sb); \
+        return zig_expand_concat(zig_float_negate_builtin_, zig_has_f##w)(w, c, sb); \
     }
-zig_float_negate_builtin(16,   16,              ,  UINT16_C(1) << 15              )
-zig_float_negate_builtin(32,   32,              ,  UINT32_C(1) << 31              )
-zig_float_negate_builtin(64,   64,              ,  UINT64_C(1) << 63              )
-zig_float_negate_builtin(80,  128, zig_make_u128, (UINT64_C(1) << 15, UINT64_C(0)))
-zig_float_negate_builtin(128, 128, zig_make_u128, (UINT64_C(1) << 63, UINT64_C(0)))
+zig_float_negate_builtin(16,               ,  UINT16_C(1) << 15              )
+zig_float_negate_builtin(32,               ,  UINT32_C(1) << 31              )
+zig_float_negate_builtin(64,               ,  UINT64_C(1) << 63              )
+zig_float_negate_builtin(80,  zig_make_u128, (UINT64_C(1) << 15, UINT64_C(0)))
+zig_float_negate_builtin(128, zig_make_u128, (UINT64_C(1) << 63, UINT64_C(0)))
 
 #define zig_float_less_builtin_0(Type, operation) \
     zig_extern int32_t zig_expand_concat(zig_expand_concat(__##operation, \
src/codegen/c.zig
@@ -3523,13 +3523,13 @@ fn airTrunc(f: *Function, inst: Air.Inst.Index) !CValue {
             try writer.writeAll("zig_shr_");
             try f.object.dg.renderTypeForBuiltinFnName(writer, scalar_ty);
             if (c_bits == 128) {
-                try writer.print("(zig_bitcast_i{d}(", .{c_bits});
+                try writer.print("(zig_bitCast_i{d}(", .{c_bits});
             } else {
                 try writer.print("((int{d}_t)", .{c_bits});
             }
             try writer.print("zig_shl_u{d}(", .{c_bits});
             if (c_bits == 128) {
-                try writer.print("zig_bitcast_u{d}(", .{c_bits});
+                try writer.print("zig_bitCast_u{d}(", .{c_bits});
             } else {
                 try writer.print("(uint{d}_t)", .{c_bits});
             }
@@ -4484,7 +4484,7 @@ fn airBitcast(f: *Function, inst: Air.Inst.Index) !CValue {
         }
         try writer.writeAll(" = ");
         if (need_bitcasts) {
-            try writer.writeAll("zig_bitcast_");
+            try writer.writeAll("zig_bitCast_");
             try f.object.dg.renderCTypeForBuiltinFnName(writer, wrap_cty.?.toUnsigned());
             try writer.writeByte('(');
         }
@@ -4496,7 +4496,7 @@ fn airBitcast(f: *Function, inst: Air.Inst.Index) !CValue {
             try f.object.dg.renderTypeForBuiltinFnName(writer, info_ty);
         try writer.writeByte('(');
         if (need_bitcasts) {
-            try writer.writeAll("zig_bitcast_");
+            try writer.writeAll("zig_bitCast_");
             try f.object.dg.renderCTypeForBuiltinFnName(writer, wrap_cty.?);
             try writer.writeByte('(');
         }