brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 493314e Raw
48 lines · plain
1; RUN: llc < %s -fast-isel -asm-verbose=false -wasm-keep-registers | FileCheck %s2 3target triple = "wasm32-unknown-unknown"4 5; Fast-isel uses a 32-bit xor with -1 to negate i1 values, because it doesn't6; make any guarantees about the contents of the high bits of a register holding7; an i1 value. Test that when we do a `br_if` or `br_unless` with what what an8; i1 value in LLVM IR, that we only test the low bit.9 10; CHECK: i32.xor11; CHECK: i32.const       $push[[L0:[0-9]+]]=, 1{{$}}12; CHECK: i32.and         $push[[L1:[0-9]+]]=, $pop{{[0-9]+}}, $pop[[L0]]{{$}}13; CHECK: br_if           0, $pop[[L1]]{{$}}14 15; CHECK: i32.xor16; CHECK: i32.const       $push[[L2:[0-9]+]]=, 1{{$}}17; CHECK: i32.and         $push[[L3:[0-9]+]]=, $pop{{[0-9]+}}, $pop[[L2]]{{$}}18; CHECK: br_if           0, $pop[[L3]]{{$}}19 20define void @test() {21start:22  %0 = call i32 @return_one()23  br label %bb124 25bb1:26  %1 = icmp eq i32 %0, 127  %2 = xor i1 %1, true28  br i1 %2, label %bb2, label %bb329 30bb2:31  call void @panic()32  unreachable33 34bb3:35  %3 = xor i1 %2, true36  br i1 %3, label %bb4, label %bb537 38bb4:39  call void @panic()40  unreachable41 42bb5:43  ret void44}45 46declare i32 @return_one()47declare void @panic()48