1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s
3 ; Test that basic 32-bit floating-point comparison operations assemble as
6 target datalayout = "e-p:32:32-i64:64-n32:64-S128"
7 target triple = "wasm32-unknown-unknown"
9 ; CHECK-LABEL: ord_f32:
10 ; CHECK-NEXT: (setlocal @0 (argument 0))
11 ; CHECK-NEXT: (setlocal @1 (argument 1))
12 ; CHECK-NEXT: (setlocal @2 (eq @1 @1))
13 ; CHECK-NEXT: (setlocal @3 (eq @0 @0))
14 ; CHECK-NEXT: (setlocal @4 (and @3 @2))
15 ; CHECK-NEXT: (return @4)
16 define i32 @ord_f32(float %x, float %y) {
17 %a = fcmp ord float %x, %y
18 %b = zext i1 %a to i32
22 ; CHECK-LABEL: uno_f32:
23 ; CHECK-NEXT: (setlocal @0 (argument 0))
24 ; CHECK-NEXT: (setlocal @1 (argument 1))
25 ; CHECK-NEXT: (setlocal @2 (ne @1 @1))
26 ; CHECK-NEXT: (setlocal @3 (ne @0 @0))
27 ; CHECK-NEXT: (setlocal @4 (ior @3 @2))
28 ; CHECK-NEXT: (return @4)
29 define i32 @uno_f32(float %x, float %y) {
30 %a = fcmp uno float %x, %y
31 %b = zext i1 %a to i32
35 ; CHECK-LABEL: oeq_f32:
36 ; CHECK-NEXT: (setlocal @0 (argument 1))
37 ; CHECK-NEXT: (setlocal @1 (argument 0))
38 ; CHECK-NEXT: (setlocal @2 (eq @1 @0))
39 ; CHECK-NEXT: (return @2)
40 define i32 @oeq_f32(float %x, float %y) {
41 %a = fcmp oeq float %x, %y
42 %b = zext i1 %a to i32
46 ; CHECK-LABEL: une_f32:
47 ; CHECK: (setlocal @2 (ne @1 @0))
48 define i32 @une_f32(float %x, float %y) {
49 %a = fcmp une float %x, %y
50 %b = zext i1 %a to i32
54 ; CHECK-LABEL: olt_f32:
55 ; CHECK: (setlocal @2 (lt @1 @0))
56 define i32 @olt_f32(float %x, float %y) {
57 %a = fcmp olt float %x, %y
58 %b = zext i1 %a to i32
62 ; CHECK-LABEL: ole_f32:
63 ; CHECK: (setlocal @2 (le @1 @0))
64 define i32 @ole_f32(float %x, float %y) {
65 %a = fcmp ole float %x, %y
66 %b = zext i1 %a to i32
70 ; CHECK-LABEL: ogt_f32:
71 ; CHECK: (setlocal @2 (gt @1 @0))
72 define i32 @ogt_f32(float %x, float %y) {
73 %a = fcmp ogt float %x, %y
74 %b = zext i1 %a to i32
78 ; CHECK-LABEL: oge_f32:
79 ; CHECK: (setlocal @2 (ge @1 @0))
80 define i32 @oge_f32(float %x, float %y) {
81 %a = fcmp oge float %x, %y
82 %b = zext i1 %a to i32
86 ; Expanded comparisons, which also check for NaN.
88 ; CHECK-LABEL: ueq_f32:
89 ; CHECK-NEXT: (setlocal @0 (argument 1))
90 ; CHECK-NEXT: (setlocal @1 (argument 0))
91 ; CHECK-NEXT: (setlocal @2 (eq @1 @0))
92 ; CHECK-NEXT: (setlocal @3 (ne @0 @0))
93 ; CHECK-NEXT: (setlocal @4 (ne @1 @1))
94 ; CHECK-NEXT: (setlocal @5 (ior @4 @3))
95 ; CHECK-NEXT: (setlocal @6 (ior @2 @5))
96 ; CHECK-NEXT: (return @6)
97 define i32 @ueq_f32(float %x, float %y) {
98 %a = fcmp ueq float %x, %y
99 %b = zext i1 %a to i32
103 ; CHECK-LABEL: one_f32:
104 ; CHECK: (setlocal @2 (ne @1 @0))
105 define i32 @one_f32(float %x, float %y) {
106 %a = fcmp one float %x, %y
107 %b = zext i1 %a to i32
111 ; CHECK-LABEL: ult_f32:
112 ; CHECK: (setlocal @2 (lt @1 @0))
113 define i32 @ult_f32(float %x, float %y) {
114 %a = fcmp ult float %x, %y
115 %b = zext i1 %a to i32
119 ; CHECK-LABEL: ule_f32:
120 ; CHECK: (setlocal @2 (le @1 @0))
121 define i32 @ule_f32(float %x, float %y) {
122 %a = fcmp ule float %x, %y
123 %b = zext i1 %a to i32
127 ; CHECK-LABEL: ugt_f32:
128 ; CHECK: (setlocal @2 (gt @1 @0))
129 define i32 @ugt_f32(float %x, float %y) {
130 %a = fcmp ugt float %x, %y
131 %b = zext i1 %a to i32
135 ; CHECK-LABEL: uge_f32:
136 ; CHECK: (setlocal @2 (ge @1 @0))
137 define i32 @uge_f32(float %x, float %y) {
138 %a = fcmp uge float %x, %y
139 %b = zext i1 %a to i32