blob: b724cec1cc63278a7ee0faf2802bb1085f0c2f6b [file] [log] [blame]
JF Bastienda06bce2015-08-11 21:02:46 +00001; RUN: llc < %s -asm-verbose=false | FileCheck %s
2
3; Test that basic 32-bit integer comparison operations assemble as expected.
4
Dan Gohmandde8dce2015-08-19 20:30:20 +00005target datalayout = "e-p:32:32-i64:64-n32:64-S128"
JF Bastienda06bce2015-08-11 21:02:46 +00006target triple = "wasm32-unknown-unknown"
7
Dan Gohmane51c0582015-10-06 00:27:55 +00008; CHECK-LABEL: eq_i32:
Dan Gohman53828fd2015-11-23 16:50:18 +00009; CHECK-NEXT: .param i32, i32{{$}}
Dan Gohmane51c0582015-10-06 00:27:55 +000010; CHECK-NEXT: .result i32{{$}}
Dan Gohman700515f2015-11-23 21:55:57 +000011; CHECK-NEXT: i32.eq $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000012; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000013define i32 @eq_i32(i32 %x, i32 %y) {
14 %a = icmp eq i32 %x, %y
15 %b = zext i1 %a to i32
16 ret i32 %b
17}
18
Dan Gohmane51c0582015-10-06 00:27:55 +000019; CHECK-LABEL: ne_i32:
Dan Gohman700515f2015-11-23 21:55:57 +000020; CHECK: i32.ne $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000021; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000022define i32 @ne_i32(i32 %x, i32 %y) {
23 %a = icmp ne i32 %x, %y
24 %b = zext i1 %a to i32
25 ret i32 %b
26}
27
Dan Gohmane51c0582015-10-06 00:27:55 +000028; CHECK-LABEL: slt_i32:
Dan Gohman700515f2015-11-23 21:55:57 +000029; CHECK: i32.lt_s $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000030; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000031define i32 @slt_i32(i32 %x, i32 %y) {
32 %a = icmp slt i32 %x, %y
33 %b = zext i1 %a to i32
34 ret i32 %b
35}
36
Dan Gohmane51c0582015-10-06 00:27:55 +000037; CHECK-LABEL: sle_i32:
Dan Gohman700515f2015-11-23 21:55:57 +000038; CHECK: i32.le_s $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000039; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000040define i32 @sle_i32(i32 %x, i32 %y) {
41 %a = icmp sle i32 %x, %y
42 %b = zext i1 %a to i32
43 ret i32 %b
44}
45
Dan Gohmane51c0582015-10-06 00:27:55 +000046; CHECK-LABEL: ult_i32:
Dan Gohman700515f2015-11-23 21:55:57 +000047; CHECK: i32.lt_u $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000048; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000049define i32 @ult_i32(i32 %x, i32 %y) {
50 %a = icmp ult i32 %x, %y
51 %b = zext i1 %a to i32
52 ret i32 %b
53}
54
Dan Gohmane51c0582015-10-06 00:27:55 +000055; CHECK-LABEL: ule_i32:
Dan Gohman700515f2015-11-23 21:55:57 +000056; CHECK: i32.le_u $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000057; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000058define i32 @ule_i32(i32 %x, i32 %y) {
59 %a = icmp ule i32 %x, %y
60 %b = zext i1 %a to i32
61 ret i32 %b
62}
63
Dan Gohmane51c0582015-10-06 00:27:55 +000064; CHECK-LABEL: sgt_i32:
Dan Gohman700515f2015-11-23 21:55:57 +000065; CHECK: i32.gt_s $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000066; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000067define i32 @sgt_i32(i32 %x, i32 %y) {
68 %a = icmp sgt i32 %x, %y
69 %b = zext i1 %a to i32
70 ret i32 %b
71}
72
Dan Gohmane51c0582015-10-06 00:27:55 +000073; CHECK-LABEL: sge_i32:
Dan Gohman700515f2015-11-23 21:55:57 +000074; CHECK: i32.ge_s $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000075; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000076define i32 @sge_i32(i32 %x, i32 %y) {
77 %a = icmp sge i32 %x, %y
78 %b = zext i1 %a to i32
79 ret i32 %b
80}
81
Dan Gohmane51c0582015-10-06 00:27:55 +000082; CHECK-LABEL: ugt_i32:
Dan Gohman700515f2015-11-23 21:55:57 +000083; CHECK: i32.gt_u $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000084; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000085define i32 @ugt_i32(i32 %x, i32 %y) {
86 %a = icmp ugt i32 %x, %y
87 %b = zext i1 %a to i32
88 ret i32 %b
89}
90
Dan Gohmane51c0582015-10-06 00:27:55 +000091; CHECK-LABEL: uge_i32:
Dan Gohman700515f2015-11-23 21:55:57 +000092; CHECK: i32.ge_u $push[[NUM:[0-9]+]]=, $0, $1{{$}}
Dan Gohman4ba48162015-11-18 16:12:01 +000093; CHECK-NEXT: return $pop[[NUM]]{{$}}
JF Bastienda06bce2015-08-11 21:02:46 +000094define i32 @uge_i32(i32 %x, i32 %y) {
95 %a = icmp uge i32 %x, %y
96 %b = zext i1 %a to i32
97 ret i32 %b
98}