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: get_local $push[[L0:[0-9]+]]=, 0{{$}} 13; CHECK-NEXT: get_local $push[[L1:[0-9]+]]=, 1{{$}} 14; CHECK-NEXT: i32.eq $push[[NUM:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} 15; CHECK-NEXT: return $pop[[NUM]]{{$}} 16define i32 @eq_i32(i32 %x, i32 %y) { 17 %a = icmp eq i32 %x, %y 18 %b = zext i1 %a to i32 19 ret i32 %b 20} 21 22; CHECK-LABEL: ne_i32: 23; CHECK: i32.ne $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} 24; CHECK-NEXT: return $pop[[NUM]]{{$}} 25define i32 @ne_i32(i32 %x, i32 %y) { 26 %a = icmp ne i32 %x, %y 27 %b = zext i1 %a to i32 28 ret i32 %b 29} 30 31; CHECK-LABEL: slt_i32: 32; CHECK: i32.lt_s $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} 33; CHECK-NEXT: return $pop[[NUM]]{{$}} 34define i32 @slt_i32(i32 %x, i32 %y) { 35 %a = icmp slt i32 %x, %y 36 %b = zext i1 %a to i32 37 ret i32 %b 38} 39 40; CHECK-LABEL: sle_i32: 41; CHECK: i32.le_s $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} 42; CHECK-NEXT: return $pop[[NUM]]{{$}} 43define i32 @sle_i32(i32 %x, i32 %y) { 44 %a = icmp sle i32 %x, %y 45 %b = zext i1 %a to i32 46 ret i32 %b 47} 48 49; CHECK-LABEL: ult_i32: 50; CHECK: i32.lt_u $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} 51; CHECK-NEXT: return $pop[[NUM]]{{$}} 52define i32 @ult_i32(i32 %x, i32 %y) { 53 %a = icmp ult i32 %x, %y 54 %b = zext i1 %a to i32 55 ret i32 %b 56} 57 58; CHECK-LABEL: ule_i32: 59; CHECK: i32.le_u $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} 60; CHECK-NEXT: return $pop[[NUM]]{{$}} 61define i32 @ule_i32(i32 %x, i32 %y) { 62 %a = icmp ule i32 %x, %y 63 %b = zext i1 %a to i32 64 ret i32 %b 65} 66 67; CHECK-LABEL: sgt_i32: 68; CHECK: i32.gt_s $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} 69; CHECK-NEXT: return $pop[[NUM]]{{$}} 70define i32 @sgt_i32(i32 %x, i32 %y) { 71 %a = icmp sgt i32 %x, %y 72 %b = zext i1 %a to i32 73 ret i32 %b 74} 75 76; CHECK-LABEL: sge_i32: 77; CHECK: i32.ge_s $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} 78; CHECK-NEXT: return $pop[[NUM]]{{$}} 79define i32 @sge_i32(i32 %x, i32 %y) { 80 %a = icmp sge i32 %x, %y 81 %b = zext i1 %a to i32 82 ret i32 %b 83} 84 85; CHECK-LABEL: ugt_i32: 86; CHECK: i32.gt_u $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} 87; CHECK-NEXT: return $pop[[NUM]]{{$}} 88define i32 @ugt_i32(i32 %x, i32 %y) { 89 %a = icmp ugt i32 %x, %y 90 %b = zext i1 %a to i32 91 ret i32 %b 92} 93 94; CHECK-LABEL: uge_i32: 95; CHECK: i32.ge_u $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} 96; CHECK-NEXT: return $pop[[NUM]]{{$}} 97define i32 @uge_i32(i32 %x, i32 %y) { 98 %a = icmp uge i32 %x, %y 99 %b = zext i1 %a to i32 100 ret i32 %b 101} 102