diff --git a/src/bigint.cpp b/src/bigint.cpp index 5c68b18a81..0a9011da8f 100644 --- a/src/bigint.cpp +++ b/src/bigint.cpp @@ -826,7 +826,7 @@ void bigint_shl(BigInt *dest, const BigInt *op1, const BigInt *op2) { const uint64_t *op1_digits = bigint_ptr(op1); uint64_t shift_amt = bigint_as_unsigned(op2); - if (op1->digit_count == 1) { + if (op1->digit_count == 1 && shift_amt < 64) { dest->data.digit = op1_digits[0] << shift_amt; if (dest->data.digit > op1_digits[0]) { dest->digit_count = 1; diff --git a/src/codegen.cpp b/src/codegen.cpp index 7581ee271c..b3de627d3e 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -3852,6 +3852,10 @@ static void build_all_basic_blocks(CodeGen *g, FnTableEntry *fn) { static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef init_val, TypeTableEntry *type_entry) { + if (g->strip_debug_symbols) { + return; + } + assert(var->gen_is_const); assert(type_entry); @@ -3863,6 +3867,7 @@ static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef ini buf_ptr(&var->name), import->di_file, (unsigned)(var->decl_node->line + 1), type_entry->di_type, is_local_to_unit); + // TODO ^^ make an actual global variable } @@ -5127,6 +5132,12 @@ static void get_c_type(CodeGen *g, TypeTableEntry *type_entry, Buf *out_buf) { case 64: buf_init_from_str(out_buf, "double"); break; + case 80: + buf_init_from_str(out_buf, "__float80"); + break; + case 128: + buf_init_from_str(out_buf, "__float128"); + break; default: zig_unreachable(); } diff --git a/std/special/compiler_rt/comparetf2.zig b/std/special/compiler_rt/comparetf2.zig index d620cd33a8..ebd629cac9 100644 --- a/std/special/compiler_rt/comparetf2.zig +++ b/std/special/compiler_rt/comparetf2.zig @@ -68,7 +68,6 @@ const GE_GREATER = c_int(1); const GE_UNORDERED = c_int(-1); // Note: different from LE_UNORDERED export fn __getf2(a: f128, b: f128) -> c_int { - const aInt = @bitCast(srep_t, a); const bInt = @bitCast(srep_t, b); const aAbs = @bitCast(rep_t, aInt) & absMask; diff --git a/test/cases/math.zig b/test/cases/math.zig index 261e171433..f950db1a14 100644 --- a/test/cases/math.zig +++ b/test/cases/math.zig @@ -313,6 +313,12 @@ test "big number multiplication" { } } +test "big number shifting" { + comptime { + assert((u128(1) << 127) == 0x80000000000000000000000000000000); + } +} + test "f128" { test_f128(); comptime test_f128(); @@ -327,4 +333,9 @@ fn test_f128() { assert(make_f128(1.0) > 0.9); assert(make_f128(1.0) >= 0.9); assert(make_f128(1.0) >= 1.0); + should_not_be_zero(1.0); +} + +fn should_not_be_zero(x: f128) { + assert(x != 0.0); }