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