1; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt | FileCheck %s 2; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -fast-isel -fast-isel-abort=1 | FileCheck %s 3 4; Test that basic 32-bit integer comparison operations assemble as expected. 5 6target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" 7target triple = "wasm32-unknown-unknown" 8 9; CHECK-LABEL: eq_i32: 10; CHECK-NEXT: .param i32, i32{{$}} 11; CHECK-NEXT: .result i32{{$}} 12; CHECK-NEXT: i32.eq $push[[NUM:[0-9]+]]=, $0, $1{{$}} 13; CHECK-NEXT: return $pop[[NUM]]{{$}} 14define i32 @eq_i32(i32 %x, i32 %y) { 15 %a = icmp eq i32 %x, %y 16 %b = zext i1 %a to i32 17 ret i32 %b 18} 19 20; CHECK-LABEL: ne_i32: 21; CHECK: i32.ne $push[[NUM:[0-9]+]]=, $0, $1{{$}} 22; CHECK-NEXT: return $pop[[NUM]]{{$}} 23define i32 @ne_i32(i32 %x, i32 %y) { 24 %a = icmp ne i32 %x, %y 25 %b = zext i1 %a to i32 26 ret i32 %b 27} 28 29; CHECK-LABEL: slt_i32: 30; CHECK: i32.lt_s $push[[NUM:[0-9]+]]=, $0, $1{{$}} 31; CHECK-NEXT: return $pop[[NUM]]{{$}} 32define i32 @slt_i32(i32 %x, i32 %y) { 33 %a = icmp slt i32 %x, %y 34 %b = zext i1 %a to i32 35 ret i32 %b 36} 37 38; CHECK-LABEL: sle_i32: 39; CHECK: i32.le_s $push[[NUM:[0-9]+]]=, $0, $1{{$}} 40; CHECK-NEXT: return $pop[[NUM]]{{$}} 41define i32 @sle_i32(i32 %x, i32 %y) { 42 %a = icmp sle i32 %x, %y 43 %b = zext i1 %a to i32 44 ret i32 %b 45} 46 47; CHECK-LABEL: ult_i32: 48; CHECK: i32.lt_u $push[[NUM:[0-9]+]]=, $0, $1{{$}} 49; CHECK-NEXT: return $pop[[NUM]]{{$}} 50define i32 @ult_i32(i32 %x, i32 %y) { 51 %a = icmp ult i32 %x, %y 52 %b = zext i1 %a to i32 53 ret i32 %b 54} 55 56; CHECK-LABEL: ule_i32: 57; CHECK: i32.le_u $push[[NUM:[0-9]+]]=, $0, $1{{$}} 58; CHECK-NEXT: return $pop[[NUM]]{{$}} 59define i32 @ule_i32(i32 %x, i32 %y) { 60 %a = icmp ule i32 %x, %y 61 %b = zext i1 %a to i32 62 ret i32 %b 63} 64 65; CHECK-LABEL: sgt_i32: 66; CHECK: i32.gt_s $push[[NUM:[0-9]+]]=, $0, $1{{$}} 67; CHECK-NEXT: return $pop[[NUM]]{{$}} 68define i32 @sgt_i32(i32 %x, i32 %y) { 69 %a = icmp sgt i32 %x, %y 70 %b = zext i1 %a to i32 71 ret i32 %b 72} 73 74; CHECK-LABEL: sge_i32: 75; CHECK: i32.ge_s $push[[NUM:[0-9]+]]=, $0, $1{{$}} 76; CHECK-NEXT: return $pop[[NUM]]{{$}} 77define i32 @sge_i32(i32 %x, i32 %y) { 78 %a = icmp sge i32 %x, %y 79 %b = zext i1 %a to i32 80 ret i32 %b 81} 82 83; CHECK-LABEL: ugt_i32: 84; CHECK: i32.gt_u $push[[NUM:[0-9]+]]=, $0, $1{{$}} 85; CHECK-NEXT: return $pop[[NUM]]{{$}} 86define i32 @ugt_i32(i32 %x, i32 %y) { 87 %a = icmp ugt i32 %x, %y 88 %b = zext i1 %a to i32 89 ret i32 %b 90} 91 92; CHECK-LABEL: uge_i32: 93; CHECK: i32.ge_u $push[[NUM:[0-9]+]]=, $0, $1{{$}} 94; CHECK-NEXT: return $pop[[NUM]]{{$}} 95define i32 @uge_i32(i32 %x, i32 %y) { 96 %a = icmp uge i32 %x, %y 97 %b = zext i1 %a to i32 98 ret i32 %b 99} 100