mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 00:08:56 +00:00
fix @bitCast with runtime scalar and dest result loc var
This commit is contained in:
parent
35352e0f48
commit
1526d89711
10
src/ir.cpp
10
src/ir.cpp
@ -24232,11 +24232,13 @@ static IrInstruction *ir_analyze_instruction_end_expr(IrAnalyze *ira, IrInstruct
|
||||
|
||||
static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInstructionBitCastSrc *instruction) {
|
||||
IrInstruction *operand = instruction->operand->child;
|
||||
if (type_is_invalid(operand->value.type) ||
|
||||
instruction->result_loc_bit_cast->parent->gen_instruction == nullptr)
|
||||
{
|
||||
if (type_is_invalid(operand->value.type))
|
||||
return operand;
|
||||
}
|
||||
|
||||
IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base,
|
||||
&instruction->result_loc_bit_cast->base, operand->value.type, operand);
|
||||
if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)))
|
||||
return result_loc;
|
||||
|
||||
return instruction->result_loc_bit_cast->parent->gen_instruction;
|
||||
}
|
||||
|
||||
@ -73,12 +73,15 @@ pub extern fn __getf2(a: f128, b: f128) c_int {
|
||||
|
||||
if (aAbs > infRep or bAbs > infRep) return GE_UNORDERED;
|
||||
if ((aAbs | bAbs) == 0) return GE_EQUAL;
|
||||
return if ((aInt & bInt) >= 0) if (aInt < bInt)
|
||||
GE_LESS
|
||||
else if (aInt == bInt)
|
||||
GE_EQUAL
|
||||
else
|
||||
GE_GREATER else if (aInt > bInt)
|
||||
// zig fmt issue here, see https://github.com/ziglang/zig/issues/2661
|
||||
return if ((aInt & bInt) >= 0)
|
||||
if (aInt < bInt)
|
||||
GE_LESS
|
||||
else if (aInt == bInt)
|
||||
GE_EQUAL
|
||||
else
|
||||
GE_GREATER
|
||||
else if (aInt > bInt)
|
||||
GE_LESS
|
||||
else if (aInt == bInt)
|
||||
GE_EQUAL
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user