llvm.org GIT mirror llvm / 8cafdf5
WebAssembly: update syntax Summary: Follow the same syntax as for the spec repo. Both have evolved slightly independently and need to converge again. This, along with wasmate changes, allows me to do the following: echo "int add(int a, int b) { return a + b; }" > add.c ./out/bin/clang -O2 -S --target=wasm32-unknown-unknown add.c -o add.wack ./experimental/prototype-wasmate/wasmate.py add.wack > add.wast ./sexpr-wasm-prototype/out/sexpr-wasm add.wast -o add.wasm ./sexpr-wasm-prototype/third_party/v8-native-prototype/v8/v8/out/Release/d8 -e "print(WASM.instantiateModule(readbuffer('add.wasm'), {print:print}).add(42, 1337));" As you'd expect, the d8 shell prints out the right value. Reviewers: sunfish Subscribers: jfb, llvm-commits, dschuff Differential Revision: http://reviews.llvm.org/D13712 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250480 91177308-0d34-0410-b5e6-96231b3b80d8 JF Bastien 4 years ago
23 changed file(s) with 976 addition(s) and 828 deletion(s). Raw diff Collapse all Expand all
4141
4242 class WebAssemblyAsmPrinter final : public AsmPrinter {
4343 const WebAssemblyInstrInfo *TII;
44 const MachineRegisterInfo *MRI;
4445 unsigned NumArgs;
4546
4647 public:
4748 WebAssemblyAsmPrinter(TargetMachine &TM, std::unique_ptr Streamer)
48 : AsmPrinter(TM, std::move(Streamer)), TII(nullptr) {}
49 : AsmPrinter(TM, std::move(Streamer)), TII(nullptr), MRI(nullptr) {}
4950
5051 private:
5152 const char *getPassName() const override {
6364 bool runOnMachineFunction(MachineFunction &MF) override {
6465 const auto &Subtarget = MF.getSubtarget();
6566 TII = Subtarget.getInstrInfo();
67 MRI = &MF.getRegInfo();
6668 NumArgs = MF.getInfo()->getNumArguments();
6769 return AsmPrinter::runOnMachineFunction(MF);
6870 }
7779
7880 void EmitInstruction(const MachineInstr *MI) override;
7981
82 std::string getRegTypeName(unsigned RegNo) const;
8083 static std::string toString(const APFloat &APF);
8184 const char *toString(Type *Ty) const;
82 std::string regToString(unsigned RegNo);
83 std::string argToString(unsigned ArgNo);
85 std::string regToString(const MachineOperand &MO);
86 std::string argToString(const MachineOperand &MO);
8487 };
8588
8689 } // end anonymous namespace
8992 // Helpers.
9093 //===----------------------------------------------------------------------===//
9194
92 // Untyped, lower-case version of the opcode's name matching the names
93 // WebAssembly opcodes are expected to have. The tablegen names are uppercase
94 // and suffixed with their type (after an underscore).
95 static SmallString<32> OpcodeName(const WebAssemblyInstrInfo *TII,
96 const MachineInstr *MI) {
95 // Operand type (if any), followed by the lower-case version of the opcode's
96 // name matching the names WebAssembly opcodes are expected to have. The
97 // tablegen names are uppercase and suffixed with their type (after an
98 // underscore).
99 static std::string OpcodeName(const WebAssemblyInstrInfo *TII,
100 const MachineInstr *MI) {
97101 std::string N(StringRef(TII->getName(MI->getOpcode())).lower());
98 std::string::size_type End = N.rfind('_');
99 End = std::string::npos == End ? N.length() : End;
100 return SmallString<32>(&N[0], &N[End]);
102 std::string::size_type Len = N.length();
103 std::string::size_type Under = N.rfind('_');
104 bool HasType = std::string::npos != Under;
105 std::string::size_type NameEnd = HasType ? Under : Len;
106 std::string Name(&N[0], &N[NameEnd]);
107 return HasType ? (std::string(&N[NameEnd + 1], &N[Len]) + '.' + Name) : Name;
101108 }
102109
103110 static std::string toSymbol(StringRef S) { return ("$" + S).str(); }
111
112 std::string WebAssemblyAsmPrinter::getRegTypeName(unsigned RegNo) const {
113 const TargetRegisterClass *TRC = MRI->getRegClass(RegNo);
114 for (MVT T : {MVT::i32, MVT::i64, MVT::f32, MVT::f64})
115 if (TRC->hasType(T))
116 return EVT(T).getEVTString();
117 DEBUG(errs() << "Unknown type for register number: " << RegNo);
118 llvm_unreachable("Unknown register type");
119 return "?";
120 }
104121
105122 std::string WebAssemblyAsmPrinter::toString(const APFloat &FP) {
106123 static const size_t BufBytes = 128;
119136 return buf;
120137 }
121138
122 std::string WebAssemblyAsmPrinter::regToString(unsigned RegNo) {
139 std::string WebAssemblyAsmPrinter::regToString(const MachineOperand &MO) {
140 unsigned RegNo = MO.getReg();
123141 if (TargetRegisterInfo::isPhysicalRegister(RegNo))
124142 return WebAssemblyInstPrinter::getRegisterName(RegNo);
125143
126144 // WebAssembly arguments and local variables are in the same index space, and
127145 // there are no explicit varargs, so we just add the number of arguments to
128146 // the virtual register number to get the local variable number.
129 return '@' + utostr(TargetRegisterInfo::virtReg2Index(RegNo) + NumArgs);
130 }
131
132 std::string WebAssemblyAsmPrinter::argToString(unsigned ArgNo) {
147 return utostr(TargetRegisterInfo::virtReg2Index(RegNo) + NumArgs);
148 }
149
150 std::string WebAssemblyAsmPrinter::argToString(const MachineOperand &MO) {
151 unsigned ArgNo = MO.getImm();
133152 // Same as above, but we don't need to add NumArgs here.
134 return '@' + utostr(ArgNo);
153 return utostr(ArgNo);
135154 }
136155
137156 const char *WebAssemblyAsmPrinter::toString(Type *Ty) const {
188207 void WebAssemblyAsmPrinter::EmitFunctionBodyStart() {
189208 const Function *F = MF->getFunction();
190209 Type *Rt = F->getReturnType();
210 SmallString<128> Str;
211 raw_svector_ostream OS(Str);
212 bool First = true;
191213
192214 if (!Rt->isVoidTy() || !F->arg_empty()) {
193 SmallString<128> Str;
194 raw_svector_ostream OS(Str);
195 bool First = true;
196215 for (const Argument &A : F->args()) {
197 OS << (First ? "" : "\n") << "\t"
198 ".param "
199 << toString(A.getType());
216 OS << (First ? "" : "\n") << "\t.param " << toString(A.getType());
200217 First = false;
201218 }
202219 if (!Rt->isVoidTy()) {
203 OS << (First ? "" : "\n") << "\t"
204 ".result "
205 << toString(Rt);
220 OS << (First ? "" : "\n") << "\t.result " << toString(Rt);
206221 First = false;
207222 }
223 }
224
225 bool FirstVReg = true;
226 for (unsigned Idx = 0, IdxE = MRI->getNumVirtRegs(); Idx != IdxE; ++Idx) {
227 unsigned VReg = TargetRegisterInfo::index2VirtReg(Idx);
228 if (!MRI->use_empty(VReg)) {
229 if (FirstVReg) {
230 OS << (First ? "" : "\n") << "\t.local ";
231 First = false;
232 }
233 OS << (FirstVReg ? "" : ", ") << getRegTypeName(VReg);
234 FirstVReg = false;
235 }
236 }
237
238 if (!First)
208239 OutStreamer->EmitRawText(OS.str());
209 }
210
211240 AsmPrinter::EmitFunctionBodyStart();
212241 }
213242
224253
225254 switch (MI->getOpcode()) {
226255 case TargetOpcode::COPY:
227 OS << regToString(MI->getOperand(1).getReg());
256 OS << "get_local " << regToString(MI->getOperand(1));
228257 break;
229258 case WebAssembly::GLOBAL:
230259 // TODO: wasm64
234263 case WebAssembly::ARGUMENT_I64:
235264 case WebAssembly::ARGUMENT_F32:
236265 case WebAssembly::ARGUMENT_F64:
237 OS << argToString(MI->getOperand(1).getImm());
266 OS << "get_local " << argToString(MI->getOperand(1));
238267 break;
239268 case WebAssembly::Immediate_I32:
240269 OS << "i32.const " << MI->getOperand(1).getImm();
262291 default:
263292 llvm_unreachable("unexpected machine operand type");
264293 case MachineOperand::MO_Register:
265 OS << regToString(MO.getReg());
294 OS << "(get_local " << regToString(MO) << ')';
266295 break;
267296 case MachineOperand::MO_Immediate:
268297 OS << MO.getImm();
287316 if (NumDefs != 0) {
288317 SmallString<128> Str;
289318 raw_svector_ostream OS(Str);
290 OS << "\t" "set_local "
291 << regToString(MI->getOperand(0).getReg()) << ", "
292 "pop";
319 const MachineOperand &Operand = MI->getOperand(0);
320 OS << "\tset_local " << regToString(Operand) << ", pop";
293321 OutStreamer->EmitRawText(OS.str());
294322 }
295323 }
1414
1515 ; CHECK-LABEL: call_i32_nullary:
1616 ; CHECK-NEXT: .result i32
17 ; CHECK-NEXT: .local i32
1718 ; CHECK-NEXT: call $i32_nullary
18 ; CHECK-NEXT: set_local @0, pop
19 ; CHECK-NEXT: return @0
19 ; CHECK-NEXT: set_local 0, pop
20 ; CHECK-NEXT: return (get_local 0)
2021 define i32 @call_i32_nullary() {
2122 %r = call i32 @i32_nullary()
2223 ret i32 %r
2425
2526 ; CHECK-LABEL: call_i64_nullary:
2627 ; CHECK-NEXT: .result i64
28 ; CHECK-NEXT: .local i64
2729 ; CHECK-NEXT: call $i64_nullary
28 ; CHECK-NEXT: set_local @0, pop
29 ; CHECK-NEXT: return @0
30 ; CHECK-NEXT: set_local 0, pop
31 ; CHECK-NEXT: return (get_local 0)
3032 define i64 @call_i64_nullary() {
3133 %r = call i64 @i64_nullary()
3234 ret i64 %r
3436
3537 ; CHECK-LABEL: call_float_nullary:
3638 ; CHECK-NEXT: .result f32
39 ; CHECK-NEXT: .local f32
3740 ; CHECK-NEXT: call $float_nullary
38 ; CHECK-NEXT: set_local @0, pop
39 ; CHECK-NEXT: return @0
41 ; CHECK-NEXT: set_local 0, pop
42 ; CHECK-NEXT: return (get_local 0)
4043 define float @call_float_nullary() {
4144 %r = call float @float_nullary()
4245 ret float %r
4447
4548 ; CHECK-LABEL: call_double_nullary:
4649 ; CHECK-NEXT: .result f64
50 ; CHECK-NEXT: .local f64
4751 ; CHECK-NEXT: call $double_nullary
48 ; CHECK-NEXT: set_local @0, pop
49 ; CHECK-NEXT: return @0
52 ; CHECK-NEXT: set_local 0, pop
53 ; CHECK-NEXT: return (get_local 0)
5054 define double @call_double_nullary() {
5155 %r = call double @double_nullary()
5256 ret double %r
6367 ; CHECK-LABEL: call_i32_unary:
6468 ; CHECK-NEXT: .param i32
6569 ; CHECK-NEXT: .result i32
66 ; CHECK-NEXT: @0
67 ; CHECK-NEXT: set_local @1, pop
68 ; CHECK-NEXT: call $i32_unary, @1
69 ; CHECK-NEXT: set_local @2, pop
70 ; CHECK-NEXT: return @2
70 ; CHECK-NEXT: .local i32, i32
71 ; CHECK-NEXT: get_local 0
72 ; CHECK-NEXT: set_local 1, pop
73 ; CHECK-NEXT: call $i32_unary, (get_local 1)
74 ; CHECK-NEXT: set_local 2, pop
75 ; CHECK-NEXT: return (get_local 2)
7176 define i32 @call_i32_unary(i32 %a) {
7277 %r = call i32 @i32_unary(i32 %a)
7378 ret i32 %r
7782 ; CHECK-NEXT: .param i32
7883 ; CHECK-NEXT: .param i32
7984 ; CHECK-NEXT: .result i32
80 ; CHECK-NEXT: @1
81 ; CHECK-NEXT: set_local @2, pop
82 ; CHECK-NEXT: @0
83 ; CHECK-NEXT: set_local @3, pop
84 ; CHECK-NEXT: call $i32_binary, @3, @2
85 ; CHECK-NEXT: set_local @4, pop
86 ; CHECK-NEXT: return @4
85 ; CHECK-NEXT: .local i32, i32, i32
86 ; CHECK-NEXT: get_local 1
87 ; CHECK-NEXT: set_local 2, pop
88 ; CHECK-NEXT: get_local 0
89 ; CHECK-NEXT: set_local 3, pop
90 ; CHECK-NEXT: call $i32_binary, (get_local 3), (get_local 2)
91 ; CHECK-NEXT: set_local 4, pop
92 ; CHECK-NEXT: return (get_local 4)
8793 define i32 @call_i32_binary(i32 %a, i32 %b) {
8894 %r = call i32 @i32_binary(i32 %a, i32 %b)
8995 ret i32 %r
9197
9298 ; CHECK-LABEL: call_indirect_void:
9399 ; CHECK-NEXT: .param i32
94 ; CHECK-NEXT: @0
95 ; CHECK-NEXT: set_local @1, pop
96 ; CHECK-NEXT: call_indirect @1
100 ; CHECK-NEXT: .local i32
101 ; CHECK-NEXT: get_local 0
102 ; CHECK-NEXT: set_local 1, pop
103 ; CHECK-NEXT: call_indirect (get_local 1)
97104 ; CHECK-NEXT: return
98105 define void @call_indirect_void(void ()* %callee) {
99106 call void %callee()
103110 ; CHECK-LABEL: call_indirect_i32:
104111 ; CHECK-NEXT: .param i32
105112 ; CHECK-NEXT: .result i32
106 ; CHECK-NEXT: @0
107 ; CHECK-NEXT: set_local @1, pop
108 ; CHECK-NEXT: call_indirect @1
109 ; CHECK-NEXT: set_local @2, pop
110 ; CHECK-NEXT: return @2
113 ; CHECK-NEXT: .local i32, i32
114 ; CHECK-NEXT: get_local 0
115 ; CHECK-NEXT: set_local 1, pop
116 ; CHECK-NEXT: call_indirect (get_local 1)
117 ; CHECK-NEXT: set_local 2, pop
118 ; CHECK-NEXT: return (get_local 2)
111119 define i32 @call_indirect_i32(i32 ()* %callee) {
112120 %t = call i32 %callee()
113121 ret i32 %t
6868 ; CHECK: block $BB2_2{{$}}
6969 ; CHECK: brif $BB2_2, {{.*}}
7070 ; CHECK: BB2_1:
71 ; CHECK: brif $BB2_1, @16{{$}}
71 ; CHECK: brif $BB2_1, (get_local 16){{$}}
7272 ; CHECK: BB2_2:
7373 ; CHECK: return{{$}}
7474 define void @test2(double* nocapture %p, i32 %n) {
100100 ; CHECK: block $BB3_5{{$}}
101101 ; CHECK: block $BB3_4{{$}}
102102 ; CHECK: block $BB3_2{{$}}
103 ; CHECK: brif $BB3_2, @7{{$}}
103 ; CHECK: brif $BB3_2, (get_local 7){{$}}
104104 ; CHECK: br $BB3_5{{$}}
105105 ; CHECK: BB3_2:
106 ; CHECK: brif $BB3_4, @10{{$}}
106 ; CHECK: brif $BB3_4, (get_local 10){{$}}
107107 ; CHECK: br $BB3_5{{$}}
108108 ; CHECK: BB3_4:
109109 ; CHECK: BB3_5:
110 ; CHECK: return @6{{$}}
110 ; CHECK: return (get_local 6){{$}}
111111 define i32 @doublediamond(i32 %a, i32 %b, i32* %p) {
112112 entry:
113113 %c = icmp eq i32 %a, 0
133133
134134 ; CHECK-LABEL: triangle:
135135 ; CHECK: block $BB4_2{{$}}
136 ; CHECK: brif $BB4_2, @5{{$}}
136 ; CHECK: brif $BB4_2, (get_local 5){{$}}
137137 ; CHECK: BB4_2:
138 ; CHECK: return @4{{$}}
138 ; CHECK: return (get_local 4){{$}}
139139 define i32 @triangle(i32* %p, i32 %a) {
140140 entry:
141141 %c = icmp eq i32 %a, 0
152152 ; CHECK-LABEL: diamond:
153153 ; CHECK: block $BB5_3{{$}}
154154 ; CHECK: block $BB5_2{{$}}
155 ; CHECK: brif $BB5_2, @5{{$}}
155 ; CHECK: brif $BB5_2, (get_local 5){{$}}
156156 ; CHECK: br $BB5_3{{$}}
157157 ; CHECK: BB5_2:
158158 ; CHECK: BB5_3:
159 ; CHECK: return @4{{$}}
159 ; CHECK: return (get_local 4){{$}}
160160 define i32 @diamond(i32* %p, i32 %a) {
161161 entry:
162162 %c = icmp eq i32 %a, 0
175175
176176 ; CHECK-LABEL: single_block:
177177 ; CHECK-NOT: br
178 ; CHECK: return @2{{$}}
178 ; CHECK: return (get_local 2){{$}}
179179 define i32 @single_block(i32* %p) {
180180 entry:
181181 store volatile i32 0, i32* %p
185185 ; CHECK-LABEL: minimal_loop:
186186 ; CHECK-NOT: br
187187 ; CHECK: BB7_1:
188 ; CHECK: store_i32 @1, @3{{$}}
188 ; CHECK: store_i32 (get_local 1), (get_local 3){{$}}
189189 ; CHECK: br $BB7_1{{$}}
190190 define i32 @minimal_loop(i32* %p) {
191191 entry:
200200 ; CHECK-NOT: br
201201 ; CHECK: BB8_1:
202202 ; CHECK: loop $BB8_2{{$}}
203 ; CHECK: brif $BB8_1, @6{{$}}
204 ; CHECK: return @4{{$}}
203 ; CHECK: brif $BB8_1, (get_local 6){{$}}
204 ; CHECK: return (get_local 4){{$}}
205205 define i32 @simple_loop(i32* %p, i32 %a) {
206206 entry:
207207 %c = icmp eq i32 %a, 0
218218 ; CHECK-LABEL: doubletriangle:
219219 ; CHECK: block $BB9_4{{$}}
220220 ; CHECK: block $BB9_3{{$}}
221 ; CHECK: brif $BB9_4, @7{{$}}
222 ; CHECK: brif $BB9_3, @10{{$}}
221 ; CHECK: brif $BB9_4, (get_local 7){{$}}
222 ; CHECK: brif $BB9_3, (get_local 10){{$}}
223223 ; CHECK: BB9_3:
224224 ; CHECK: BB9_4:
225 ; CHECK: return @6{{$}}
225 ; CHECK: return (get_local 6){{$}}
226226 define i32 @doubletriangle(i32 %a, i32 %b, i32* %p) {
227227 entry:
228228 %c = icmp eq i32 %a, 0
246246 ; CHECK-LABEL: ifelse_earlyexits:
247247 ; CHECK: block $BB10_4{{$}}
248248 ; CHECK: block $BB10_2{{$}}
249 ; CHECK: brif $BB10_2, @7{{$}}
249 ; CHECK: brif $BB10_2, (get_local 7){{$}}
250250 ; CHECK: br $BB10_4{{$}}
251251 ; CHECK: BB10_2:
252 ; CHECK: brif $BB10_4, @10{{$}}
252 ; CHECK: brif $BB10_4, (get_local 10){{$}}
253253 ; CHECK: BB10_4:
254 ; CHECK: return @6{{$}}
254 ; CHECK: return (get_local 6){{$}}
255255 define i32 @ifelse_earlyexits(i32 %a, i32 %b, i32* %p) {
256256 entry:
257257 %c = icmp eq i32 %a, 0
99 ; CHECK-NEXT: .param f32{{$}}
1010 ; CHECK-NEXT: .param f32{{$}}
1111 ; CHECK-NEXT: .result i32{{$}}
12 ; CHECK-NEXT: @0{{$}}
13 ; CHECK-NEXT: set_local @2, pop{{$}}
14 ; CHECK-NEXT: @1{{$}}
15 ; CHECK-NEXT: set_local @3, pop{{$}}
16 ; CHECK-NEXT: eq @3, @3{{$}}
17 ; CHECK-NEXT: set_local @4, pop{{$}}
18 ; CHECK-NEXT: eq @2, @2{{$}}
19 ; CHECK-NEXT: set_local @5, pop{{$}}
20 ; CHECK-NEXT: and @5, @4{{$}}
21 ; CHECK-NEXT: set_local @6, pop{{$}}
22 ; CHECK-NEXT: return @6{{$}}
12 ; CHECK-NEXT: .local f32, f32, i32, i32, i32{{$}}
13 ; CHECK-NEXT: get_local 0{{$}}
14 ; CHECK-NEXT: set_local 2, pop{{$}}
15 ; CHECK-NEXT: get_local 1{{$}}
16 ; CHECK-NEXT: set_local 3, pop{{$}}
17 ; CHECK-NEXT: eq (get_local 3), (get_local 3){{$}}
18 ; CHECK-NEXT: set_local 4, pop{{$}}
19 ; CHECK-NEXT: eq (get_local 2), (get_local 2){{$}}
20 ; CHECK-NEXT: set_local 5, pop{{$}}
21 ; CHECK-NEXT: and (get_local 5), (get_local 4){{$}}
22 ; CHECK-NEXT: set_local 6, pop{{$}}
23 ; CHECK-NEXT: return (get_local 6){{$}}
2324 define i32 @ord_f32(float %x, float %y) {
2425 %a = fcmp ord float %x, %y
2526 %b = zext i1 %a to i32
3031 ; CHECK-NEXT: .param f32{{$}}
3132 ; CHECK-NEXT: .param f32{{$}}
3233 ; CHECK-NEXT: .result i32{{$}}
33 ; CHECK-NEXT: @0{{$}}
34 ; CHECK-NEXT: set_local @2, pop{{$}}
35 ; CHECK-NEXT: @1{{$}}
36 ; CHECK-NEXT: set_local @3, pop{{$}}
37 ; CHECK-NEXT: ne @3, @3{{$}}
38 ; CHECK-NEXT: set_local @4, pop{{$}}
39 ; CHECK-NEXT: ne @2, @2{{$}}
40 ; CHECK-NEXT: set_local @5, pop{{$}}
41 ; CHECK-NEXT: ior @5, @4{{$}}
42 ; CHECK-NEXT: set_local @6, pop{{$}}
43 ; CHECK-NEXT: return @6{{$}}
34 ; CHECK-NEXT: .local f32, f32, i32, i32, i32{{$}}
35 ; CHECK-NEXT: get_local 0{{$}}
36 ; CHECK-NEXT: set_local 2, pop{{$}}
37 ; CHECK-NEXT: get_local 1{{$}}
38 ; CHECK-NEXT: set_local 3, pop{{$}}
39 ; CHECK-NEXT: ne (get_local 3), (get_local 3){{$}}
40 ; CHECK-NEXT: set_local 4, pop{{$}}
41 ; CHECK-NEXT: ne (get_local 2), (get_local 2){{$}}
42 ; CHECK-NEXT: set_local 5, pop{{$}}
43 ; CHECK-NEXT: ior (get_local 5), (get_local 4){{$}}
44 ; CHECK-NEXT: set_local 6, pop{{$}}
45 ; CHECK-NEXT: return (get_local 6){{$}}
4446 define i32 @uno_f32(float %x, float %y) {
4547 %a = fcmp uno float %x, %y
4648 %b = zext i1 %a to i32
5153 ; CHECK-NEXT: .param f32{{$}}
5254 ; CHECK-NEXT: .param f32{{$}}
5355 ; CHECK-NEXT: .result i32{{$}}
54 ; CHECK-NEXT: @1{{$}}
55 ; CHECK-NEXT: set_local @2, pop{{$}}
56 ; CHECK-NEXT: @0{{$}}
57 ; CHECK-NEXT: set_local @3, pop{{$}}
58 ; CHECK-NEXT: eq @3, @2{{$}}
59 ; CHECK-NEXT: set_local @4, pop{{$}}
60 ; CHECK-NEXT: return @4{{$}}
56 ; CHECK-NEXT: .local f32, f32, i32{{$}}
57 ; CHECK-NEXT: get_local 1{{$}}
58 ; CHECK-NEXT: set_local 2, pop{{$}}
59 ; CHECK-NEXT: get_local 0{{$}}
60 ; CHECK-NEXT: set_local 3, pop{{$}}
61 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
62 ; CHECK-NEXT: set_local 4, pop{{$}}
63 ; CHECK-NEXT: return (get_local 4){{$}}
6164 define i32 @oeq_f32(float %x, float %y) {
6265 %a = fcmp oeq float %x, %y
6366 %b = zext i1 %a to i32
6568 }
6669
6770 ; CHECK-LABEL: une_f32:
68 ; CHECK: ne @3, @2{{$}}
69 ; CHECK-NEXT: set_local @4, pop{{$}}
71 ; CHECK: ne (get_local 3), (get_local 2){{$}}
72 ; CHECK-NEXT: set_local 4, pop{{$}}
7073 define i32 @une_f32(float %x, float %y) {
7174 %a = fcmp une float %x, %y
7275 %b = zext i1 %a to i32
7477 }
7578
7679 ; CHECK-LABEL: olt_f32:
77 ; CHECK: lt @3, @2{{$}}
78 ; CHECK-NEXT: set_local @4, pop{{$}}
80 ; CHECK: lt (get_local 3), (get_local 2){{$}}
81 ; CHECK-NEXT: set_local 4, pop{{$}}
7982 define i32 @olt_f32(float %x, float %y) {
8083 %a = fcmp olt float %x, %y
8184 %b = zext i1 %a to i32
8386 }
8487
8588 ; CHECK-LABEL: ole_f32:
86 ; CHECK: le @3, @2{{$}}
87 ; CHECK-NEXT: set_local @4, pop{{$}}
89 ; CHECK: le (get_local 3), (get_local 2){{$}}
90 ; CHECK-NEXT: set_local 4, pop{{$}}
8891 define i32 @ole_f32(float %x, float %y) {
8992 %a = fcmp ole float %x, %y
9093 %b = zext i1 %a to i32
9295 }
9396
9497 ; CHECK-LABEL: ogt_f32:
95 ; CHECK: gt @3, @2{{$}}
96 ; CHECK-NEXT: set_local @4, pop{{$}}
98 ; CHECK: gt (get_local 3), (get_local 2){{$}}
99 ; CHECK-NEXT: set_local 4, pop{{$}}
97100 define i32 @ogt_f32(float %x, float %y) {
98101 %a = fcmp ogt float %x, %y
99102 %b = zext i1 %a to i32
101104 }
102105
103106 ; CHECK-LABEL: oge_f32:
104 ; CHECK: ge @3, @2{{$}}
105 ; CHECK-NEXT: set_local @4, pop{{$}}
107 ; CHECK: ge (get_local 3), (get_local 2){{$}}
108 ; CHECK-NEXT: set_local 4, pop{{$}}
106109 define i32 @oge_f32(float %x, float %y) {
107110 %a = fcmp oge float %x, %y
108111 %b = zext i1 %a to i32
115118 ; CHECK-NEXT: .param f32{{$}}
116119 ; CHECK-NEXT: .param f32{{$}}
117120 ; CHECK-NEXT: .result i32{{$}}
118 ; CHECK-NEXT: @1{{$}}
119 ; CHECK-NEXT: set_local @2, pop{{$}}
120 ; CHECK-NEXT: @0{{$}}
121 ; CHECK-NEXT: set_local @3, pop{{$}}
122 ; CHECK-NEXT: eq @3, @2{{$}}
123 ; CHECK-NEXT: set_local @4, pop{{$}}
124 ; CHECK-NEXT: ne @2, @2{{$}}
125 ; CHECK-NEXT: set_local @5, pop{{$}}
126 ; CHECK-NEXT: ne @3, @3{{$}}
127 ; CHECK-NEXT: set_local @6, pop{{$}}
128 ; CHECK-NEXT: ior @6, @5{{$}}
129 ; CHECK-NEXT: set_local @7, pop{{$}}
130 ; CHECK-NEXT: ior @4, @7{{$}}
131 ; CHECK-NEXT: set_local @8, pop{{$}}
132 ; CHECK-NEXT: return @8{{$}}
121 ; CHECK-NEXT: .local f32, f32, i32, i32, i32, i32, i32{{$}}
122 ; CHECK-NEXT: get_local 1{{$}}
123 ; CHECK-NEXT: set_local 2, pop{{$}}
124 ; CHECK-NEXT: get_local 0{{$}}
125 ; CHECK-NEXT: set_local 3, pop{{$}}
126 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
127 ; CHECK-NEXT: set_local 4, pop{{$}}
128 ; CHECK-NEXT: ne (get_local 2), (get_local 2){{$}}
129 ; CHECK-NEXT: set_local 5, pop{{$}}
130 ; CHECK-NEXT: ne (get_local 3), (get_local 3){{$}}
131 ; CHECK-NEXT: set_local 6, pop{{$}}
132 ; CHECK-NEXT: ior (get_local 6), (get_local 5){{$}}
133 ; CHECK-NEXT: set_local 7, pop{{$}}
134 ; CHECK-NEXT: ior (get_local 4), (get_local 7){{$}}
135 ; CHECK-NEXT: set_local 8, pop{{$}}
136 ; CHECK-NEXT: return (get_local 8){{$}}
133137 define i32 @ueq_f32(float %x, float %y) {
134138 %a = fcmp ueq float %x, %y
135139 %b = zext i1 %a to i32
137141 }
138142
139143 ; CHECK-LABEL: one_f32:
140 ; CHECK: ne @3, @2{{$}}
141 ; CHECK-NEXT: set_local @4, pop{{$}}
144 ; CHECK: ne (get_local 3), (get_local 2){{$}}
145 ; CHECK-NEXT: set_local 4, pop{{$}}
142146 define i32 @one_f32(float %x, float %y) {
143147 %a = fcmp one float %x, %y
144148 %b = zext i1 %a to i32
146150 }
147151
148152 ; CHECK-LABEL: ult_f32:
149 ; CHECK: lt @3, @2{{$}}
150 ; CHECK-NEXT: set_local @4, pop{{$}}
153 ; CHECK: lt (get_local 3), (get_local 2){{$}}
154 ; CHECK-NEXT: set_local 4, pop{{$}}
151155 define i32 @ult_f32(float %x, float %y) {
152156 %a = fcmp ult float %x, %y
153157 %b = zext i1 %a to i32
155159 }
156160
157161 ; CHECK-LABEL: ule_f32:
158 ; CHECK: le @3, @2{{$}}
159 ; CHECK-NEXT: set_local @4, pop{{$}}
162 ; CHECK: le (get_local 3), (get_local 2){{$}}
163 ; CHECK-NEXT: set_local 4, pop{{$}}
160164 define i32 @ule_f32(float %x, float %y) {
161165 %a = fcmp ule float %x, %y
162166 %b = zext i1 %a to i32
164168 }
165169
166170 ; CHECK-LABEL: ugt_f32:
167 ; CHECK: gt @3, @2{{$}}
168 ; CHECK-NEXT: set_local @4, pop{{$}}
171 ; CHECK: gt (get_local 3), (get_local 2){{$}}
172 ; CHECK-NEXT: set_local 4, pop{{$}}
169173 define i32 @ugt_f32(float %x, float %y) {
170174 %a = fcmp ugt float %x, %y
171175 %b = zext i1 %a to i32
173177 }
174178
175179 ; CHECK-LABEL: uge_f32:
176 ; CHECK: ge @3, @2{{$}}
177 ; CHECK-NEXT: set_local @4, pop{{$}}
180 ; CHECK: ge (get_local 3), (get_local 2){{$}}
181 ; CHECK-NEXT: set_local 4, pop{{$}}
178182 define i32 @uge_f32(float %x, float %y) {
179183 %a = fcmp uge float %x, %y
180184 %b = zext i1 %a to i32
99 ; CHECK-NEXT: .param f64{{$}}
1010 ; CHECK-NEXT: .param f64{{$}}
1111 ; CHECK-NEXT: .result i32{{$}}
12 ; CHECK-NEXT: @0{{$}}
13 ; CHECK-NEXT: set_local @2, pop{{$}}
14 ; CHECK-NEXT: @1{{$}}
15 ; CHECK-NEXT: set_local @3, pop{{$}}
16 ; CHECK-NEXT: eq @3, @3{{$}}
17 ; CHECK-NEXT: set_local @4, pop{{$}}
18 ; CHECK-NEXT: eq @2, @2{{$}}
19 ; CHECK-NEXT: set_local @5, pop{{$}}
20 ; CHECK-NEXT: and @5, @4{{$}}
21 ; CHECK-NEXT: set_local @6, pop{{$}}
22 ; CHECK-NEXT: return @6{{$}}
12 ; CHECK-NEXT: .local f64, f64, i32, i32, i32{{$}}
13 ; CHECK-NEXT: get_local 0{{$}}
14 ; CHECK-NEXT: set_local 2, pop{{$}}
15 ; CHECK-NEXT: get_local 1{{$}}
16 ; CHECK-NEXT: set_local 3, pop{{$}}
17 ; CHECK-NEXT: eq (get_local 3), (get_local 3){{$}}
18 ; CHECK-NEXT: set_local 4, pop{{$}}
19 ; CHECK-NEXT: eq (get_local 2), (get_local 2){{$}}
20 ; CHECK-NEXT: set_local 5, pop{{$}}
21 ; CHECK-NEXT: and (get_local 5), (get_local 4){{$}}
22 ; CHECK-NEXT: set_local 6, pop{{$}}
23 ; CHECK-NEXT: return (get_local 6){{$}}
2324 define i32 @ord_f64(double %x, double %y) {
2425 %a = fcmp ord double %x, %y
2526 %b = zext i1 %a to i32
3031 ; CHECK-NEXT: .param f64{{$}}
3132 ; CHECK-NEXT: .param f64{{$}}
3233 ; CHECK-NEXT: .result i32{{$}}
33 ; CHECK-NEXT: @0{{$}}
34 ; CHECK-NEXT: set_local @2, pop{{$}}
35 ; CHECK-NEXT: @1{{$}}
36 ; CHECK-NEXT: set_local @3, pop{{$}}
37 ; CHECK-NEXT: ne @3, @3{{$}}
38 ; CHECK-NEXT: set_local @4, pop{{$}}
39 ; CHECK-NEXT: ne @2, @2{{$}}
40 ; CHECK-NEXT: set_local @5, pop{{$}}
41 ; CHECK-NEXT: ior @5, @4{{$}}
42 ; CHECK-NEXT: set_local @6, pop{{$}}
43 ; CHECK-NEXT: return @6{{$}}
34 ; CHECK-NEXT: .local f64, f64, i32, i32, i32{{$}}
35 ; CHECK-NEXT: get_local 0{{$}}
36 ; CHECK-NEXT: set_local 2, pop{{$}}
37 ; CHECK-NEXT: get_local 1{{$}}
38 ; CHECK-NEXT: set_local 3, pop{{$}}
39 ; CHECK-NEXT: ne (get_local 3), (get_local 3){{$}}
40 ; CHECK-NEXT: set_local 4, pop{{$}}
41 ; CHECK-NEXT: ne (get_local 2), (get_local 2){{$}}
42 ; CHECK-NEXT: set_local 5, pop{{$}}
43 ; CHECK-NEXT: ior (get_local 5), (get_local 4){{$}}
44 ; CHECK-NEXT: set_local 6, pop{{$}}
45 ; CHECK-NEXT: return (get_local 6){{$}}
4446 define i32 @uno_f64(double %x, double %y) {
4547 %a = fcmp uno double %x, %y
4648 %b = zext i1 %a to i32
5153 ; CHECK-NEXT: .param f64{{$}}
5254 ; CHECK-NEXT: .param f64{{$}}
5355 ; CHECK-NEXT: .result i32{{$}}
54 ; CHECK-NEXT: @1{{$}}
55 ; CHECK-NEXT: set_local @2, pop{{$}}
56 ; CHECK-NEXT: @0{{$}}
57 ; CHECK-NEXT: set_local @3, pop{{$}}
58 ; CHECK-NEXT: eq @3, @2{{$}}
59 ; CHECK-NEXT: set_local @4, pop{{$}}
60 ; CHECK-NEXT: return @4{{$}}
56 ; CHECK-NEXT: .local f64, f64, i32{{$}}
57 ; CHECK-NEXT: get_local 1{{$}}
58 ; CHECK-NEXT: set_local 2, pop{{$}}
59 ; CHECK-NEXT: get_local 0{{$}}
60 ; CHECK-NEXT: set_local 3, pop{{$}}
61 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
62 ; CHECK-NEXT: set_local 4, pop{{$}}
63 ; CHECK-NEXT: return (get_local 4){{$}}
6164 define i32 @oeq_f64(double %x, double %y) {
6265 %a = fcmp oeq double %x, %y
6366 %b = zext i1 %a to i32
6568 }
6669
6770 ; CHECK-LABEL: une_f64:
68 ; CHECK: ne @3, @2{{$}}
69 ; CHECK-NEXT: set_local @4, pop{{$}}
71 ; CHECK: ne (get_local 3), (get_local 2){{$}}
72 ; CHECK-NEXT: set_local 4, pop{{$}}
7073 define i32 @une_f64(double %x, double %y) {
7174 %a = fcmp une double %x, %y
7275 %b = zext i1 %a to i32
7477 }
7578
7679 ; CHECK-LABEL: olt_f64:
77 ; CHECK: lt @3, @2{{$}}
78 ; CHECK-NEXT: set_local @4, pop{{$}}
80 ; CHECK: lt (get_local 3), (get_local 2){{$}}
81 ; CHECK-NEXT: set_local 4, pop{{$}}
7982 define i32 @olt_f64(double %x, double %y) {
8083 %a = fcmp olt double %x, %y
8184 %b = zext i1 %a to i32
8386 }
8487
8588 ; CHECK-LABEL: ole_f64:
86 ; CHECK: le @3, @2{{$}}
87 ; CHECK-NEXT: set_local @4, pop{{$}}
89 ; CHECK: le (get_local 3), (get_local 2){{$}}
90 ; CHECK-NEXT: set_local 4, pop{{$}}
8891 define i32 @ole_f64(double %x, double %y) {
8992 %a = fcmp ole double %x, %y
9093 %b = zext i1 %a to i32
9295 }
9396
9497 ; CHECK-LABEL: ogt_f64:
95 ; CHECK: gt @3, @2{{$}}
96 ; CHECK-NEXT: set_local @4, pop{{$}}
98 ; CHECK: gt (get_local 3), (get_local 2){{$}}
99 ; CHECK-NEXT: set_local 4, pop{{$}}
97100 define i32 @ogt_f64(double %x, double %y) {
98101 %a = fcmp ogt double %x, %y
99102 %b = zext i1 %a to i32
101104 }
102105
103106 ; CHECK-LABEL: oge_f64:
104 ; CHECK: ge @3, @2{{$}}
105 ; CHECK-NEXT: set_local @4, pop{{$}}
107 ; CHECK: ge (get_local 3), (get_local 2){{$}}
108 ; CHECK-NEXT: set_local 4, pop{{$}}
106109 define i32 @oge_f64(double %x, double %y) {
107110 %a = fcmp oge double %x, %y
108111 %b = zext i1 %a to i32
115118 ; CHECK-NEXT: .param f64{{$}}
116119 ; CHECK-NEXT: .param f64{{$}}
117120 ; CHECK-NEXT: .result i32{{$}}
118 ; CHECK-NEXT: @1{{$}}
119 ; CHECK-NEXT: set_local @2, pop{{$}}
120 ; CHECK-NEXT: @0{{$}}
121 ; CHECK-NEXT: set_local @3, pop{{$}}
122 ; CHECK-NEXT: eq @3, @2{{$}}
123 ; CHECK-NEXT: set_local @4, pop{{$}}
124 ; CHECK-NEXT: ne @2, @2{{$}}
125 ; CHECK-NEXT: set_local @5, pop{{$}}
126 ; CHECK-NEXT: ne @3, @3{{$}}
127 ; CHECK-NEXT: set_local @6, pop{{$}}
128 ; CHECK-NEXT: ior @6, @5{{$}}
129 ; CHECK-NEXT: set_local @7, pop{{$}}
130 ; CHECK-NEXT: ior @4, @7{{$}}
131 ; CHECK-NEXT: set_local @8, pop{{$}}
132 ; CHECK-NEXT: return @8{{$}}
121 ; CHECK-NEXT: .local f64, f64, i32, i32, i32, i32, i32{{$}}
122 ; CHECK-NEXT: get_local 1{{$}}
123 ; CHECK-NEXT: set_local 2, pop{{$}}
124 ; CHECK-NEXT: get_local 0{{$}}
125 ; CHECK-NEXT: set_local 3, pop{{$}}
126 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
127 ; CHECK-NEXT: set_local 4, pop{{$}}
128 ; CHECK-NEXT: ne (get_local 2), (get_local 2){{$}}
129 ; CHECK-NEXT: set_local 5, pop{{$}}
130 ; CHECK-NEXT: ne (get_local 3), (get_local 3){{$}}
131 ; CHECK-NEXT: set_local 6, pop{{$}}
132 ; CHECK-NEXT: ior (get_local 6), (get_local 5){{$}}
133 ; CHECK-NEXT: set_local 7, pop{{$}}
134 ; CHECK-NEXT: ior (get_local 4), (get_local 7){{$}}
135 ; CHECK-NEXT: set_local 8, pop{{$}}
136 ; CHECK-NEXT: return (get_local 8){{$}}
133137 define i32 @ueq_f64(double %x, double %y) {
134138 %a = fcmp ueq double %x, %y
135139 %b = zext i1 %a to i32
137141 }
138142
139143 ; CHECK-LABEL: one_f64:
140 ; CHECK: ne @3, @2{{$}}
141 ; CHECK-NEXT: set_local @4, pop{{$}}
144 ; CHECK: ne (get_local 3), (get_local 2){{$}}
145 ; CHECK-NEXT: set_local 4, pop{{$}}
142146 define i32 @one_f64(double %x, double %y) {
143147 %a = fcmp one double %x, %y
144148 %b = zext i1 %a to i32
146150 }
147151
148152 ; CHECK-LABEL: ult_f64:
149 ; CHECK: lt @3, @2{{$}}
150 ; CHECK-NEXT: set_local @4, pop{{$}}
153 ; CHECK: lt (get_local 3), (get_local 2){{$}}
154 ; CHECK-NEXT: set_local 4, pop{{$}}
151155 define i32 @ult_f64(double %x, double %y) {
152156 %a = fcmp ult double %x, %y
153157 %b = zext i1 %a to i32
155159 }
156160
157161 ; CHECK-LABEL: ule_f64:
158 ; CHECK: le @3, @2{{$}}
159 ; CHECK-NEXT: set_local @4, pop{{$}}
162 ; CHECK: le (get_local 3), (get_local 2){{$}}
163 ; CHECK-NEXT: set_local 4, pop{{$}}
160164 define i32 @ule_f64(double %x, double %y) {
161165 %a = fcmp ule double %x, %y
162166 %b = zext i1 %a to i32
164168 }
165169
166170 ; CHECK-LABEL: ugt_f64:
167 ; CHECK: gt @3, @2{{$}}
168 ; CHECK-NEXT: set_local @4, pop{{$}}
171 ; CHECK: gt (get_local 3), (get_local 2){{$}}
172 ; CHECK-NEXT: set_local 4, pop{{$}}
169173 define i32 @ugt_f64(double %x, double %y) {
170174 %a = fcmp ugt double %x, %y
171175 %b = zext i1 %a to i32
173177 }
174178
175179 ; CHECK-LABEL: uge_f64:
176 ; CHECK: ge @3, @2{{$}}
177 ; CHECK-NEXT: set_local @4, pop{{$}}
180 ; CHECK: ge (get_local 3), (get_local 2){{$}}
181 ; CHECK-NEXT: set_local 4, pop{{$}}
178182 define i32 @uge_f64(double %x, double %y) {
179183 %a = fcmp uge double %x, %y
180184 %b = zext i1 %a to i32
88 ; CHECK-NEXT: .param i32{{$}}
99 ; CHECK-NEXT: .param i32{{$}}
1010 ; CHECK-NEXT: .result i32{{$}}
11 ; CHECK-NEXT: @1{{$}}
12 ; CHECK-NEXT: set_local @2, pop{{$}}
13 ; CHECK-NEXT: @0{{$}}
14 ; CHECK-NEXT: set_local @3, pop{{$}}
15 ; CHECK-NEXT: eq @3, @2{{$}}
16 ; CHECK-NEXT: set_local @4, pop{{$}}
17 ; CHECK-NEXT: return @4{{$}}
11 ; CHECK-NEXT: .local i32, i32, i32{{$}}
12 ; CHECK-NEXT: get_local 1{{$}}
13 ; CHECK-NEXT: set_local 2, pop{{$}}
14 ; CHECK-NEXT: get_local 0{{$}}
15 ; CHECK-NEXT: set_local 3, pop{{$}}
16 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
17 ; CHECK-NEXT: set_local 4, pop{{$}}
18 ; CHECK-NEXT: return (get_local 4){{$}}
1819 define i32 @eq_i32(i32 %x, i32 %y) {
1920 %a = icmp eq i32 %x, %y
2021 %b = zext i1 %a to i32
2223 }
2324
2425 ; CHECK-LABEL: ne_i32:
25 ; CHECK: ne @3, @2{{$}}
26 ; CHECK-NEXT: set_local @4, pop{{$}}
26 ; CHECK: ne (get_local 3), (get_local 2){{$}}
27 ; CHECK-NEXT: set_local 4, pop{{$}}
2728 define i32 @ne_i32(i32 %x, i32 %y) {
2829 %a = icmp ne i32 %x, %y
2930 %b = zext i1 %a to i32
3132 }
3233
3334 ; CHECK-LABEL: slt_i32:
34 ; CHECK: slt @3, @2{{$}}
35 ; CHECK-NEXT: set_local @4, pop{{$}}
35 ; CHECK: slt (get_local 3), (get_local 2){{$}}
36 ; CHECK-NEXT: set_local 4, pop{{$}}
3637 define i32 @slt_i32(i32 %x, i32 %y) {
3738 %a = icmp slt i32 %x, %y
3839 %b = zext i1 %a to i32
4041 }
4142
4243 ; CHECK-LABEL: sle_i32:
43 ; CHECK: sle @3, @2{{$}}
44 ; CHECK-NEXT: set_local @4, pop{{$}}
44 ; CHECK: sle (get_local 3), (get_local 2){{$}}
45 ; CHECK-NEXT: set_local 4, pop{{$}}
4546 define i32 @sle_i32(i32 %x, i32 %y) {
4647 %a = icmp sle i32 %x, %y
4748 %b = zext i1 %a to i32
4950 }
5051
5152 ; CHECK-LABEL: ult_i32:
52 ; CHECK: ult @3, @2{{$}}
53 ; CHECK-NEXT: set_local @4, pop{{$}}
53 ; CHECK: ult (get_local 3), (get_local 2){{$}}
54 ; CHECK-NEXT: set_local 4, pop{{$}}
5455 define i32 @ult_i32(i32 %x, i32 %y) {
5556 %a = icmp ult i32 %x, %y
5657 %b = zext i1 %a to i32
5859 }
5960
6061 ; CHECK-LABEL: ule_i32:
61 ; CHECK: ule @3, @2{{$}}
62 ; CHECK-NEXT: set_local @4, pop{{$}}
62 ; CHECK: ule (get_local 3), (get_local 2){{$}}
63 ; CHECK-NEXT: set_local 4, pop{{$}}
6364 define i32 @ule_i32(i32 %x, i32 %y) {
6465 %a = icmp ule i32 %x, %y
6566 %b = zext i1 %a to i32
6768 }
6869
6970 ; CHECK-LABEL: sgt_i32:
70 ; CHECK: sgt @3, @2{{$}}
71 ; CHECK-NEXT: set_local @4, pop{{$}}
71 ; CHECK: sgt (get_local 3), (get_local 2){{$}}
72 ; CHECK-NEXT: set_local 4, pop{{$}}
7273 define i32 @sgt_i32(i32 %x, i32 %y) {
7374 %a = icmp sgt i32 %x, %y
7475 %b = zext i1 %a to i32
7677 }
7778
7879 ; CHECK-LABEL: sge_i32:
79 ; CHECK: sge @3, @2{{$}}
80 ; CHECK-NEXT: set_local @4, pop{{$}}
80 ; CHECK: sge (get_local 3), (get_local 2){{$}}
81 ; CHECK-NEXT: set_local 4, pop{{$}}
8182 define i32 @sge_i32(i32 %x, i32 %y) {
8283 %a = icmp sge i32 %x, %y
8384 %b = zext i1 %a to i32
8586 }
8687
8788 ; CHECK-LABEL: ugt_i32:
88 ; CHECK: ugt @3, @2{{$}}
89 ; CHECK-NEXT: set_local @4, pop{{$}}
89 ; CHECK: ugt (get_local 3), (get_local 2){{$}}
90 ; CHECK-NEXT: set_local 4, pop{{$}}
9091 define i32 @ugt_i32(i32 %x, i32 %y) {
9192 %a = icmp ugt i32 %x, %y
9293 %b = zext i1 %a to i32
9495 }
9596
9697 ; CHECK-LABEL: uge_i32:
97 ; CHECK: uge @3, @2{{$}}
98 ; CHECK-NEXT: set_local @4, pop{{$}}
98 ; CHECK: uge (get_local 3), (get_local 2){{$}}
99 ; CHECK-NEXT: set_local 4, pop{{$}}
99100 define i32 @uge_i32(i32 %x, i32 %y) {
100101 %a = icmp uge i32 %x, %y
101102 %b = zext i1 %a to i32
88 ; CHECK-NEXT: .param i64{{$}}
99 ; CHECK-NEXT: .param i64{{$}}
1010 ; CHECK-NEXT: .result i32{{$}}
11 ; CHECK-NEXT: @1{{$}}
12 ; CHECK-NEXT: set_local @2, pop{{$}}
13 ; CHECK-NEXT: @0{{$}}
14 ; CHECK-NEXT: set_local @3, pop{{$}}
15 ; CHECK-NEXT: eq @3, @2{{$}}
16 ; CHECK-NEXT: set_local @4, pop{{$}}
17 ; CHECK-NEXT: return @4{{$}}
11 ; CHECK-NEXT: .local i64, i64, i32{{$}}
12 ; CHECK-NEXT: get_local 1{{$}}
13 ; CHECK-NEXT: set_local 2, pop{{$}}
14 ; CHECK-NEXT: get_local 0{{$}}
15 ; CHECK-NEXT: set_local 3, pop{{$}}
16 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
17 ; CHECK-NEXT: set_local 4, pop{{$}}
18 ; CHECK-NEXT: return (get_local 4){{$}}
1819 define i32 @eq_i64(i64 %x, i64 %y) {
1920 %a = icmp eq i64 %x, %y
2021 %b = zext i1 %a to i32
2223 }
2324
2425 ; CHECK-LABEL: ne_i64:
25 ; CHECK: ne @3, @2{{$}}
26 ; CHECK-NEXT: set_local @4, pop{{$}}
26 ; CHECK: ne (get_local 3), (get_local 2){{$}}
27 ; CHECK-NEXT: set_local 4, pop{{$}}
2728 define i32 @ne_i64(i64 %x, i64 %y) {
2829 %a = icmp ne i64 %x, %y
2930 %b = zext i1 %a to i32
3132 }
3233
3334 ; CHECK-LABEL: slt_i64:
34 ; CHECK: slt @3, @2{{$}}
35 ; CHECK-NEXT: set_local @4, pop{{$}}
35 ; CHECK: slt (get_local 3), (get_local 2){{$}}
36 ; CHECK-NEXT: set_local 4, pop{{$}}
3637 define i32 @slt_i64(i64 %x, i64 %y) {
3738 %a = icmp slt i64 %x, %y
3839 %b = zext i1 %a to i32
4041 }
4142
4243 ; CHECK-LABEL: sle_i64:
43 ; CHECK: sle @3, @2{{$}}
44 ; CHECK-NEXT: set_local @4, pop{{$}}
44 ; CHECK: sle (get_local 3), (get_local 2){{$}}
45 ; CHECK-NEXT: set_local 4, pop{{$}}
4546 define i32 @sle_i64(i64 %x, i64 %y) {
4647 %a = icmp sle i64 %x, %y
4748 %b = zext i1 %a to i32
4950 }
5051
5152 ; CHECK-LABEL: ult_i64:
52 ; CHECK: ult @3, @2{{$}}
53 ; CHECK-NEXT: set_local @4, pop{{$}}
53 ; CHECK: ult (get_local 3), (get_local 2){{$}}
54 ; CHECK-NEXT: set_local 4, pop{{$}}
5455 define i32 @ult_i64(i64 %x, i64 %y) {
5556 %a = icmp ult i64 %x, %y
5657 %b = zext i1 %a to i32
5859 }
5960
6061 ; CHECK-LABEL: ule_i64:
61 ; CHECK: ule @3, @2{{$}}
62 ; CHECK-NEXT: set_local @4, pop{{$}}
62 ; CHECK: ule (get_local 3), (get_local 2){{$}}
63 ; CHECK-NEXT: set_local 4, pop{{$}}
6364 define i32 @ule_i64(i64 %x, i64 %y) {
6465 %a = icmp ule i64 %x, %y
6566 %b = zext i1 %a to i32
6768 }
6869
6970 ; CHECK-LABEL: sgt_i64:
70 ; CHECK: sgt @3, @2{{$}}
71 ; CHECK-NEXT: set_local @4, pop{{$}}
71 ; CHECK: sgt (get_local 3), (get_local 2){{$}}
72 ; CHECK-NEXT: set_local 4, pop{{$}}
7273 define i32 @sgt_i64(i64 %x, i64 %y) {
7374 %a = icmp sgt i64 %x, %y
7475 %b = zext i1 %a to i32
7677 }
7778
7879 ; CHECK-LABEL: sge_i64:
79 ; CHECK: sge @3, @2{{$}}
80 ; CHECK-NEXT: set_local @4, pop{{$}}
80 ; CHECK: sge (get_local 3), (get_local 2){{$}}
81 ; CHECK-NEXT: set_local 4, pop{{$}}
8182 define i32 @sge_i64(i64 %x, i64 %y) {
8283 %a = icmp sge i64 %x, %y
8384 %b = zext i1 %a to i32
8586 }
8687
8788 ; CHECK-LABEL: ugt_i64:
88 ; CHECK: ugt @3, @2{{$}}
89 ; CHECK-NEXT: set_local @4, pop{{$}}
89 ; CHECK: ugt (get_local 3), (get_local 2){{$}}
90 ; CHECK-NEXT: set_local 4, pop{{$}}
9091 define i32 @ugt_i64(i64 %x, i64 %y) {
9192 %a = icmp ugt i64 %x, %y
9293 %b = zext i1 %a to i32
9495 }
9596
9697 ; CHECK-LABEL: uge_i64:
97 ; CHECK: uge @3, @2{{$}}
98 ; CHECK-NEXT: set_local @4, pop{{$}}
98 ; CHECK: uge (get_local 3), (get_local 2){{$}}
99 ; CHECK-NEXT: set_local 4, pop{{$}}
99100 define i32 @uge_i64(i64 %x, i64 %y) {
100101 %a = icmp uge i64 %x, %y
101102 %b = zext i1 %a to i32
77 ; CHECK-LABEL: i32_wrap_i64:
88 ; CHECK-NEXT: .param i64{{$}}
99 ; CHECK-NEXT: .result i32{{$}}
10 ; CHECK-NEXT: @0{{$}}
11 ; CHECK-NEXT: set_local @1, pop{{$}}
12 ; CHECK-NEXT: i32_wrap @1{{$}}
13 ; CHECK-NEXT: set_local @2, pop{{$}}
14 ; CHECK-NEXT: return @2{{$}}
10 ; CHECK-NEXT: .local i64, i32{{$}}
11 ; CHECK-NEXT: get_local 0{{$}}
12 ; CHECK-NEXT: set_local 1, pop{{$}}
13 ; CHECK-NEXT: i32_wrap (get_local 1){{$}}
14 ; CHECK-NEXT: set_local 2, pop{{$}}
15 ; CHECK-NEXT: return (get_local 2){{$}}
1516 define i32 @i32_wrap_i64(i64 %x) {
1617 %a = trunc i64 %x to i32
1718 ret i32 %a
2021 ; CHECK-LABEL: i64_extend_s_i32:
2122 ; CHECK-NEXT: .param i32
2223 ; CHECK-NEXT: .result i64
23 ; CHECK-NEXT: @0{{$}}
24 ; CHECK-NEXT: set_local @1, pop{{$}}
25 ; CHECK-NEXT: i64_extend_s @1{{$}}
26 ; CHECK-NEXT: set_local @2, pop{{$}}
27 ; CHECK-NEXT: return @2{{$}}
24 ; CHECK-NEXT: .local i32, i64{{$}}
25 ; CHECK-NEXT: get_local 0{{$}}
26 ; CHECK-NEXT: set_local 1, pop{{$}}
27 ; CHECK-NEXT: i64_extend_s (get_local 1){{$}}
28 ; CHECK-NEXT: set_local 2, pop{{$}}
29 ; CHECK-NEXT: return (get_local 2){{$}}
2830 define i64 @i64_extend_s_i32(i32 %x) {
2931 %a = sext i32 %x to i64
3032 ret i64 %a
3335 ; CHECK-LABEL: i64_extend_u_i32:
3436 ; CHECK-NEXT: .param i32
3537 ; CHECK-NEXT: .result i64
36 ; CHECK-NEXT: @0{{$}}
37 ; CHECK-NEXT: set_local @1, pop{{$}}
38 ; CHECK-NEXT: i64_extend_u @1{{$}}
39 ; CHECK-NEXT: set_local @2, pop{{$}}
40 ; CHECK-NEXT: return @2{{$}}
38 ; CHECK-NEXT: .local i32, i64{{$}}
39 ; CHECK-NEXT: get_local 0{{$}}
40 ; CHECK-NEXT: set_local 1, pop{{$}}
41 ; CHECK-NEXT: i64_extend_u (get_local 1){{$}}
42 ; CHECK-NEXT: set_local 2, pop{{$}}
43 ; CHECK-NEXT: return (get_local 2){{$}}
4144 define i64 @i64_extend_u_i32(i32 %x) {
4245 %a = zext i32 %x to i64
4346 ret i64 %a
4649 ; CHECK-LABEL: i32_trunc_s_f32:
4750 ; CHECK-NEXT: .param f32
4851 ; CHECK-NEXT: .result i32
49 ; CHECK-NEXT: @0{{$}}
50 ; CHECK-NEXT: set_local @1, pop{{$}}
51 ; CHECK-NEXT: i32_trunc_s @1{{$}}
52 ; CHECK-NEXT: set_local @2, pop{{$}}
53 ; CHECK-NEXT: return @2{{$}}
52 ; CHECK-NEXT: .local f32, i32{{$}}
53 ; CHECK-NEXT: get_local 0{{$}}
54 ; CHECK-NEXT: set_local 1, pop{{$}}
55 ; CHECK-NEXT: i32_trunc_s (get_local 1){{$}}
56 ; CHECK-NEXT: set_local 2, pop{{$}}
57 ; CHECK-NEXT: return (get_local 2){{$}}
5458 define i32 @i32_trunc_s_f32(float %x) {
5559 %a = fptosi float %x to i32
5660 ret i32 %a
5963 ; CHECK-LABEL: i32_trunc_u_f32:
6064 ; CHECK-NEXT: .param f32
6165 ; CHECK-NEXT: .result i32
62 ; CHECK-NEXT: @0{{$}}
63 ; CHECK-NEXT: set_local @1, pop{{$}}
64 ; CHECK-NEXT: i32_trunc_u @1{{$}}
65 ; CHECK-NEXT: set_local @2, pop{{$}}
66 ; CHECK-NEXT: return @2{{$}}
66 ; CHECK-NEXT: .local f32, i32{{$}}
67 ; CHECK-NEXT: get_local 0{{$}}
68 ; CHECK-NEXT: set_local 1, pop{{$}}
69 ; CHECK-NEXT: i32_trunc_u (get_local 1){{$}}
70 ; CHECK-NEXT: set_local 2, pop{{$}}
71 ; CHECK-NEXT: return (get_local 2){{$}}
6772 define i32 @i32_trunc_u_f32(float %x) {
6873 %a = fptoui float %x to i32
6974 ret i32 %a
7277 ; CHECK-LABEL: i32_trunc_s_f64:
7378 ; CHECK-NEXT: .param f64
7479 ; CHECK-NEXT: .result i32
75 ; CHECK-NEXT: @0{{$}}
76 ; CHECK-NEXT: set_local @1, pop{{$}}
77 ; CHECK-NEXT: i32_trunc_s @1{{$}}
78 ; CHECK-NEXT: set_local @2, pop{{$}}
79 ; CHECK-NEXT: return @2{{$}}
80 ; CHECK-NEXT: .local f64, i32{{$}}
81 ; CHECK-NEXT: get_local 0{{$}}
82 ; CHECK-NEXT: set_local 1, pop{{$}}
83 ; CHECK-NEXT: i32_trunc_s (get_local 1){{$}}
84 ; CHECK-NEXT: set_local 2, pop{{$}}
85 ; CHECK-NEXT: return (get_local 2){{$}}
8086 define i32 @i32_trunc_s_f64(double %x) {
8187 %a = fptosi double %x to i32
8288 ret i32 %a
8591 ; CHECK-LABEL: i32_trunc_u_f64:
8692 ; CHECK-NEXT: .param f64
8793 ; CHECK-NEXT: .result i32
88 ; CHECK-NEXT: @0{{$}}
89 ; CHECK-NEXT: set_local @1, pop{{$}}
90 ; CHECK-NEXT: i32_trunc_u @1{{$}}
91 ; CHECK-NEXT: set_local @2, pop{{$}}
92 ; CHECK-NEXT: return @2{{$}}
94 ; CHECK-NEXT: .local f64, i32{{$}}
95 ; CHECK-NEXT: get_local 0{{$}}
96 ; CHECK-NEXT: set_local 1, pop{{$}}
97 ; CHECK-NEXT: i32_trunc_u (get_local 1){{$}}
98 ; CHECK-NEXT: set_local 2, pop{{$}}
99 ; CHECK-NEXT: return (get_local 2){{$}}
93100 define i32 @i32_trunc_u_f64(double %x) {
94101 %a = fptoui double %x to i32
95102 ret i32 %a
98105 ; CHECK-LABEL: i64_trunc_s_f32:
99106 ; CHECK-NEXT: .param f32
100107 ; CHECK-NEXT: .result i64
101 ; CHECK-NEXT: @0{{$}}
102 ; CHECK-NEXT: set_local @1, pop{{$}}
103 ; CHECK-NEXT: i64_trunc_s @1{{$}}
104 ; CHECK-NEXT: set_local @2, pop{{$}}
105 ; CHECK-NEXT: return @2{{$}}
108 ; CHECK-NEXT: .local f32, i64{{$}}
109 ; CHECK-NEXT: get_local 0{{$}}
110 ; CHECK-NEXT: set_local 1, pop{{$}}
111 ; CHECK-NEXT: i64_trunc_s (get_local 1){{$}}
112 ; CHECK-NEXT: set_local 2, pop{{$}}
113 ; CHECK-NEXT: return (get_local 2){{$}}
106114 define i64 @i64_trunc_s_f32(float %x) {
107115 %a = fptosi float %x to i64
108116 ret i64 %a
111119 ; CHECK-LABEL: i64_trunc_u_f32:
112120 ; CHECK-NEXT: .param f32
113121 ; CHECK-NEXT: .result i64
114 ; CHECK-NEXT: @0{{$}}
115 ; CHECK-NEXT: set_local @1, pop{{$}}
116 ; CHECK-NEXT: i64_trunc_u @1{{$}}
117 ; CHECK-NEXT: set_local @2, pop{{$}}
118 ; CHECK-NEXT: return @2{{$}}
122 ; CHECK-NEXT: .local f32, i64{{$}}
123 ; CHECK-NEXT: get_local 0{{$}}
124 ; CHECK-NEXT: set_local 1, pop{{$}}
125 ; CHECK-NEXT: i64_trunc_u (get_local 1){{$}}
126 ; CHECK-NEXT: set_local 2, pop{{$}}
127 ; CHECK-NEXT: return (get_local 2){{$}}
119128 define i64 @i64_trunc_u_f32(float %x) {
120129 %a = fptoui float %x to i64
121130 ret i64 %a
124133 ; CHECK-LABEL: i64_trunc_s_f64:
125134 ; CHECK-NEXT: .param f64
126135 ; CHECK-NEXT: .result i64
127 ; CHECK-NEXT: @0{{$}}
128 ; CHECK-NEXT: set_local @1, pop{{$}}
129 ; CHECK-NEXT: i64_trunc_s @1{{$}}
130 ; CHECK-NEXT: set_local @2, pop{{$}}
131 ; CHECK-NEXT: return @2{{$}}
136 ; CHECK-NEXT: .local f64, i64{{$}}
137 ; CHECK-NEXT: get_local 0{{$}}
138 ; CHECK-NEXT: set_local 1, pop{{$}}
139 ; CHECK-NEXT: i64_trunc_s (get_local 1){{$}}
140 ; CHECK-NEXT: set_local 2, pop{{$}}
141 ; CHECK-NEXT: return (get_local 2){{$}}
132142 define i64 @i64_trunc_s_f64(double %x) {
133143 %a = fptosi double %x to i64
134144 ret i64 %a
137147 ; CHECK-LABEL: i64_trunc_u_f64:
138148 ; CHECK-NEXT: .param f64
139149 ; CHECK-NEXT: .result i64
140 ; CHECK-NEXT: @0{{$}}
141 ; CHECK-NEXT: set_local @1, pop{{$}}
142 ; CHECK-NEXT: i64_trunc_u @1{{$}}
143 ; CHECK-NEXT: set_local @2, pop{{$}}
144 ; CHECK-NEXT: return @2{{$}}
150 ; CHECK-NEXT: .local f64, i64{{$}}
151 ; CHECK-NEXT: get_local 0{{$}}
152 ; CHECK-NEXT: set_local 1, pop{{$}}
153 ; CHECK-NEXT: i64_trunc_u (get_local 1){{$}}
154 ; CHECK-NEXT: set_local 2, pop{{$}}
155 ; CHECK-NEXT: return (get_local 2){{$}}
145156 define i64 @i64_trunc_u_f64(double %x) {
146157 %a = fptoui double %x to i64
147158 ret i64 %a
150161 ; CHECK-LABEL: f32_convert_s_i32:
151162 ; CHECK-NEXT: .param i32
152163 ; CHECK-NEXT: .result f32
153 ; CHECK-NEXT: @0{{$}}
154 ; CHECK-NEXT: set_local @1, pop{{$}}
155 ; CHECK-NEXT: f32_convert_s @1{{$}}
156 ; CHECK-NEXT: set_local @2, pop{{$}}
157 ; CHECK-NEXT: return @2{{$}}
164 ; CHECK-NEXT: .local i32, f32{{$}}
165 ; CHECK-NEXT: get_local 0{{$}}
166 ; CHECK-NEXT: set_local 1, pop{{$}}
167 ; CHECK-NEXT: f32_convert_s (get_local 1){{$}}
168 ; CHECK-NEXT: set_local 2, pop{{$}}
169 ; CHECK-NEXT: return (get_local 2){{$}}
158170 define float @f32_convert_s_i32(i32 %x) {
159171 %a = sitofp i32 %x to float
160172 ret float %a
163175 ; CHECK-LABEL: f32_convert_u_i32:
164176 ; CHECK-NEXT: .param i32
165177 ; CHECK-NEXT: .result f32
166 ; CHECK-NEXT: @0{{$}}
167 ; CHECK-NEXT: set_local @1, pop{{$}}
168 ; CHECK-NEXT: f32_convert_u @1{{$}}
169 ; CHECK-NEXT: set_local @2, pop{{$}}
170 ; CHECK-NEXT: return @2{{$}}
178 ; CHECK-NEXT: .local i32, f32{{$}}
179 ; CHECK-NEXT: get_local 0{{$}}
180 ; CHECK-NEXT: set_local 1, pop{{$}}
181 ; CHECK-NEXT: f32_convert_u (get_local 1){{$}}
182 ; CHECK-NEXT: set_local 2, pop{{$}}
183 ; CHECK-NEXT: return (get_local 2){{$}}
171184 define float @f32_convert_u_i32(i32 %x) {
172185 %a = uitofp i32 %x to float
173186 ret float %a
176189 ; CHECK-LABEL: f64_convert_s_i32:
177190 ; CHECK-NEXT: .param i32
178191 ; CHECK-NEXT: .result f64
179 ; CHECK-NEXT: @0{{$}}
180 ; CHECK-NEXT: set_local @1, pop{{$}}
181 ; CHECK-NEXT: f64_convert_s @1{{$}}
182 ; CHECK-NEXT: set_local @2, pop{{$}}
183 ; CHECK-NEXT: return @2{{$}}
192 ; CHECK-NEXT: .local i32, f64{{$}}
193 ; CHECK-NEXT: get_local 0{{$}}
194 ; CHECK-NEXT: set_local 1, pop{{$}}
195 ; CHECK-NEXT: f64_convert_s (get_local 1){{$}}
196 ; CHECK-NEXT: set_local 2, pop{{$}}
197 ; CHECK-NEXT: return (get_local 2){{$}}
184198 define double @f64_convert_s_i32(i32 %x) {
185199 %a = sitofp i32 %x to double
186200 ret double %a
189203 ; CHECK-LABEL: f64_convert_u_i32:
190204 ; CHECK-NEXT: .param i32
191205 ; CHECK-NEXT: .result f64
192 ; CHECK-NEXT: @0{{$}}
193 ; CHECK-NEXT: set_local @1, pop{{$}}
194 ; CHECK-NEXT: f64_convert_u @1{{$}}
195 ; CHECK-NEXT: set_local @2, pop{{$}}
196 ; CHECK-NEXT: return @2{{$}}
206 ; CHECK-NEXT: .local i32, f64{{$}}
207 ; CHECK-NEXT: get_local 0{{$}}
208 ; CHECK-NEXT: set_local 1, pop{{$}}
209 ; CHECK-NEXT: f64_convert_u (get_local 1){{$}}
210 ; CHECK-NEXT: set_local 2, pop{{$}}
211 ; CHECK-NEXT: return (get_local 2){{$}}
197212 define double @f64_convert_u_i32(i32 %x) {
198213 %a = uitofp i32 %x to double
199214 ret double %a
202217 ; CHECK-LABEL: f32_convert_s_i64:
203218 ; CHECK-NEXT: .param i64
204219 ; CHECK-NEXT: .result f32
205 ; CHECK-NEXT: @0{{$}}
206 ; CHECK-NEXT: set_local @1, pop{{$}}
207 ; CHECK-NEXT: f32_convert_s @1{{$}}
208 ; CHECK-NEXT: set_local @2, pop{{$}}
209 ; CHECK-NEXT: return @2{{$}}
220 ; CHECK-NEXT: .local i64, f32{{$}}
221 ; CHECK-NEXT: get_local 0{{$}}
222 ; CHECK-NEXT: set_local 1, pop{{$}}
223 ; CHECK-NEXT: f32_convert_s (get_local 1){{$}}
224 ; CHECK-NEXT: set_local 2, pop{{$}}
225 ; CHECK-NEXT: return (get_local 2){{$}}
210226 define float @f32_convert_s_i64(i64 %x) {
211227 %a = sitofp i64 %x to float
212228 ret float %a
215231 ; CHECK-LABEL: f32_convert_u_i64:
216232 ; CHECK-NEXT: .param i64
217233 ; CHECK-NEXT: .result f32
218 ; CHECK-NEXT: @0{{$}}
219 ; CHECK-NEXT: set_local @1, pop{{$}}
220 ; CHECK-NEXT: f32_convert_u @1{{$}}
221 ; CHECK-NEXT: set_local @2, pop{{$}}
222 ; CHECK-NEXT: return @2{{$}}
234 ; CHECK-NEXT: .local i64, f32{{$}}
235 ; CHECK-NEXT: get_local 0{{$}}
236 ; CHECK-NEXT: set_local 1, pop{{$}}
237 ; CHECK-NEXT: f32_convert_u (get_local 1){{$}}
238 ; CHECK-NEXT: set_local 2, pop{{$}}
239 ; CHECK-NEXT: return (get_local 2){{$}}
223240 define float @f32_convert_u_i64(i64 %x) {
224241 %a = uitofp i64 %x to float
225242 ret float %a
228245 ; CHECK-LABEL: f64_convert_s_i64:
229246 ; CHECK-NEXT: .param i64
230247 ; CHECK-NEXT: .result f64
231 ; CHECK-NEXT: @0{{$}}
232 ; CHECK-NEXT: set_local @1, pop{{$}}
233 ; CHECK-NEXT: f64_convert_s @1{{$}}
234 ; CHECK-NEXT: set_local @2, pop{{$}}
235 ; CHECK-NEXT: return @2{{$}}
248 ; CHECK-NEXT: .local i64, f64{{$}}
249 ; CHECK-NEXT: get_local 0{{$}}
250 ; CHECK-NEXT: set_local 1, pop{{$}}
251 ; CHECK-NEXT: f64_convert_s (get_local 1){{$}}
252 ; CHECK-NEXT: set_local 2, pop{{$}}
253 ; CHECK-NEXT: return (get_local 2){{$}}
236254 define double @f64_convert_s_i64(i64 %x) {
237255 %a = sitofp i64 %x to double
238256 ret double %a
241259 ; CHECK-LABEL: f64_convert_u_i64:
242260 ; CHECK-NEXT: .param i64
243261 ; CHECK-NEXT: .result f64
244 ; CHECK-NEXT: @0{{$}}
245 ; CHECK-NEXT: set_local @1, pop{{$}}
246 ; CHECK-NEXT: f64_convert_u @1{{$}}
247 ; CHECK-NEXT: set_local @2, pop{{$}}
248 ; CHECK-NEXT: return @2{{$}}
262 ; CHECK-NEXT: .local i64, f64{{$}}
263 ; CHECK-NEXT: get_local 0{{$}}
264 ; CHECK-NEXT: set_local 1, pop{{$}}
265 ; CHECK-NEXT: f64_convert_u (get_local 1){{$}}
266 ; CHECK-NEXT: set_local 2, pop{{$}}
267 ; CHECK-NEXT: return (get_local 2){{$}}
249268 define double @f64_convert_u_i64(i64 %x) {
250269 %a = uitofp i64 %x to double
251270 ret double %a
254273 ; CHECK-LABEL: f64_promote_f32:
255274 ; CHECK-NEXT: .param f32
256275 ; CHECK-NEXT: .result f64
257 ; CHECK-NEXT: @0{{$}}
258 ; CHECK-NEXT: set_local @1, pop{{$}}
259 ; CHECK-NEXT: f64_promote @1{{$}}
260 ; CHECK-NEXT: set_local @2, pop{{$}}
261 ; CHECK-NEXT: return @2{{$}}
276 ; CHECK-NEXT: .local f32, f64{{$}}
277 ; CHECK-NEXT: get_local 0{{$}}
278 ; CHECK-NEXT: set_local 1, pop{{$}}
279 ; CHECK-NEXT: f64_promote (get_local 1){{$}}
280 ; CHECK-NEXT: set_local 2, pop{{$}}
281 ; CHECK-NEXT: return (get_local 2){{$}}
262282 define double @f64_promote_f32(float %x) {
263283 %a = fpext float %x to double
264284 ret double %a
267287 ; CHECK-LABEL: f32_demote_f64:
268288 ; CHECK-NEXT: .param f64
269289 ; CHECK-NEXT: .result f32
270 ; CHECK-NEXT: @0{{$}}
271 ; CHECK-NEXT: set_local @1, pop{{$}}
272 ; CHECK-NEXT: f32_demote @1{{$}}
273 ; CHECK-NEXT: set_local @2, pop{{$}}
274 ; CHECK-NEXT: return @2{{$}}
290 ; CHECK-NEXT: .local f64, f32{{$}}
291 ; CHECK-NEXT: get_local 0{{$}}
292 ; CHECK-NEXT: set_local 1, pop{{$}}
293 ; CHECK-NEXT: f32_demote (get_local 1){{$}}
294 ; CHECK-NEXT: set_local 2, pop{{$}}
295 ; CHECK-NEXT: return (get_local 2){{$}}
275296 define float @f32_demote_f64(double %x) {
276297 %a = fptrunc double %x to float
277298 ret float %a
1717 ; CHECK-NEXT: .param f32{{$}}
1818 ; CHECK-NEXT: .param f32{{$}}
1919 ; CHECK-NEXT: .result f32{{$}}
20 ; CHECK-NEXT: @1{{$}}
21 ; CHECK-NEXT: set_local @2, pop{{$}}
22 ; CHECK-NEXT: @0{{$}}
23 ; CHECK-NEXT: set_local @3, pop{{$}}
24 ; CHECK-NEXT: add @3, @2{{$}}
25 ; CHECK-NEXT: set_local @4, pop{{$}}
26 ; CHECK-NEXT: return @4{{$}}
20 ; CHECK-NEXT: .local f32, f32, f32{{$}}
21 ; CHECK-NEXT: get_local 1{{$}}
22 ; CHECK-NEXT: set_local 2, pop{{$}}
23 ; CHECK-NEXT: get_local 0{{$}}
24 ; CHECK-NEXT: set_local 3, pop{{$}}
25 ; CHECK-NEXT: add (get_local 3), (get_local 2){{$}}
26 ; CHECK-NEXT: set_local 4, pop{{$}}
27 ; CHECK-NEXT: return (get_local 4){{$}}
2728 define float @fadd32(float %x, float %y) {
2829 %a = fadd float %x, %y
2930 ret float %a
3031 }
3132
3233 ; CHECK-LABEL: fsub32:
33 ; CHECK: sub @3, @2{{$}}
34 ; CHECK-NEXT: set_local @4, pop{{$}}
34 ; CHECK: sub (get_local 3), (get_local 2){{$}}
35 ; CHECK-NEXT: set_local 4, pop{{$}}
3536 define float @fsub32(float %x, float %y) {
3637 %a = fsub float %x, %y
3738 ret float %a
3839 }
3940
4041 ; CHECK-LABEL: fmul32:
41 ; CHECK: mul @3, @2{{$}}
42 ; CHECK-NEXT: set_local @4, pop{{$}}
42 ; CHECK: mul (get_local 3), (get_local 2){{$}}
43 ; CHECK-NEXT: set_local 4, pop{{$}}
4344 define float @fmul32(float %x, float %y) {
4445 %a = fmul float %x, %y
4546 ret float %a
4647 }
4748
4849 ; CHECK-LABEL: fdiv32:
49 ; CHECK: div @3, @2{{$}}
50 ; CHECK-NEXT: set_local @4, pop{{$}}
50 ; CHECK: div (get_local 3), (get_local 2){{$}}
51 ; CHECK-NEXT: set_local 4, pop{{$}}
5152 define float @fdiv32(float %x, float %y) {
5253 %a = fdiv float %x, %y
5354 ret float %a
5455 }
5556
5657 ; CHECK-LABEL: fabs32:
57 ; CHECK: abs @1{{$}}
58 ; CHECK-NEXT: set_local @2, pop{{$}}
58 ; CHECK: abs (get_local 1){{$}}
59 ; CHECK-NEXT: set_local 2, pop{{$}}
5960 define float @fabs32(float %x) {
6061 %a = call float @llvm.fabs.f32(float %x)
6162 ret float %a
6263 }
6364
6465 ; CHECK-LABEL: fneg32:
65 ; CHECK: neg @1{{$}}
66 ; CHECK-NEXT: set_local @2, pop{{$}}
66 ; CHECK: neg (get_local 1){{$}}
67 ; CHECK-NEXT: set_local 2, pop{{$}}
6768 define float @fneg32(float %x) {
6869 %a = fsub float -0., %x
6970 ret float %a
7071 }
7172
7273 ; CHECK-LABEL: copysign32:
73 ; CHECK: copysign @3, @2{{$}}
74 ; CHECK-NEXT: set_local @4, pop{{$}}
74 ; CHECK: copysign (get_local 3), (get_local 2){{$}}
75 ; CHECK-NEXT: set_local 4, pop{{$}}
7576 define float @copysign32(float %x, float %y) {
7677 %a = call float @llvm.copysign.f32(float %x, float %y)
7778 ret float %a
7879 }
7980
8081 ; CHECK-LABEL: sqrt32:
81 ; CHECK: sqrt @1{{$}}
82 ; CHECK-NEXT: set_local @2, pop{{$}}
82 ; CHECK: sqrt (get_local 1){{$}}
83 ; CHECK-NEXT: set_local 2, pop{{$}}
8384 define float @sqrt32(float %x) {
8485 %a = call float @llvm.sqrt.f32(float %x)
8586 ret float %a
8687 }
8788
8889 ; CHECK-LABEL: ceil32:
89 ; CHECK: ceil @1{{$}}
90 ; CHECK-NEXT: set_local @2, pop{{$}}
90 ; CHECK: ceil (get_local 1){{$}}
91 ; CHECK-NEXT: set_local 2, pop{{$}}
9192 define float @ceil32(float %x) {
9293 %a = call float @llvm.ceil.f32(float %x)
9394 ret float %a
9495 }
9596
9697 ; CHECK-LABEL: floor32:
97 ; CHECK: floor @1{{$}}
98 ; CHECK-NEXT: set_local @2, pop{{$}}
98 ; CHECK: floor (get_local 1){{$}}
99 ; CHECK-NEXT: set_local 2, pop{{$}}
99100 define float @floor32(float %x) {
100101 %a = call float @llvm.floor.f32(float %x)
101102 ret float %a
102103 }
103104
104105 ; CHECK-LABEL: trunc32:
105 ; CHECK: trunc @1{{$}}
106 ; CHECK-NEXT: set_local @2, pop{{$}}
106 ; CHECK: trunc (get_local 1){{$}}
107 ; CHECK-NEXT: set_local 2, pop{{$}}
107108 define float @trunc32(float %x) {
108109 %a = call float @llvm.trunc.f32(float %x)
109110 ret float %a
110111 }
111112
112113 ; CHECK-LABEL: nearest32:
113 ; CHECK: nearest @1{{$}}
114 ; CHECK-NEXT: set_local @2, pop{{$}}
114 ; CHECK: nearest (get_local 1){{$}}
115 ; CHECK-NEXT: set_local 2, pop{{$}}
115116 define float @nearest32(float %x) {
116117 %a = call float @llvm.nearbyint.f32(float %x)
117118 ret float %a
118119 }
119120
120121 ; CHECK-LABEL: nearest32_via_rint:
121 ; CHECK: nearest @1{{$}}
122 ; CHECK-NEXT: set_local @2, pop{{$}}
122 ; CHECK: nearest (get_local 1){{$}}
123 ; CHECK-NEXT: set_local 2, pop{{$}}
123124 define float @nearest32_via_rint(float %x) {
124125 %a = call float @llvm.rint.f32(float %x)
125126 ret float %a
1717 ; CHECK-NEXT: .param f64{{$}}
1818 ; CHECK-NEXT: .param f64{{$}}
1919 ; CHECK-NEXT: .result f64{{$}}
20 ; CHECK-NEXT: @1{{$}}
21 ; CHECK-NEXT: set_local @2, pop{{$}}
22 ; CHECK-NEXT: @0{{$}}
23 ; CHECK-NEXT: set_local @3, pop{{$}}
24 ; CHECK-NEXT: add @3, @2{{$}}
25 ; CHECK-NEXT: set_local @4, pop{{$}}
26 ; CHECK-NEXT: return @4{{$}}
20 ; CHECK-NEXT: .local f64, f64, f64{{$}}
21 ; CHECK-NEXT: get_local 1{{$}}
22 ; CHECK-NEXT: set_local 2, pop{{$}}
23 ; CHECK-NEXT: get_local 0{{$}}
24 ; CHECK-NEXT: set_local 3, pop{{$}}
25 ; CHECK-NEXT: add (get_local 3), (get_local 2){{$}}
26 ; CHECK-NEXT: set_local 4, pop{{$}}
27 ; CHECK-NEXT: return (get_local 4){{$}}
2728 define double @fadd64(double %x, double %y) {
2829 %a = fadd double %x, %y
2930 ret double %a
3031 }
3132
3233 ; CHECK-LABEL: fsub64:
33 ; CHECK: sub @3, @2{{$}}
34 ; CHECK-NEXT: set_local @4, pop{{$}}
34 ; CHECK: sub (get_local 3), (get_local 2){{$}}
35 ; CHECK-NEXT: set_local 4, pop{{$}}
3536 define double @fsub64(double %x, double %y) {
3637 %a = fsub double %x, %y
3738 ret double %a
3839 }
3940
4041 ; CHECK-LABEL: fmul64:
41 ; CHECK: mul @3, @2{{$}}
42 ; CHECK-NEXT: set_local @4, pop{{$}}
42 ; CHECK: mul (get_local 3), (get_local 2){{$}}
43 ; CHECK-NEXT: set_local 4, pop{{$}}
4344 define double @fmul64(double %x, double %y) {
4445 %a = fmul double %x, %y
4546 ret double %a
4647 }
4748
4849 ; CHECK-LABEL: fdiv64:
49 ; CHECK: div @3, @2{{$}}
50 ; CHECK-NEXT: set_local @4, pop{{$}}
50 ; CHECK: div (get_local 3), (get_local 2){{$}}
51 ; CHECK-NEXT: set_local 4, pop{{$}}
5152 define double @fdiv64(double %x, double %y) {
5253 %a = fdiv double %x, %y
5354 ret double %a
5455 }
5556
5657 ; CHECK-LABEL: fabs64:
57 ; CHECK: abs @1{{$}}
58 ; CHECK-NEXT: set_local @2, pop{{$}}
58 ; CHECK: abs (get_local 1){{$}}
59 ; CHECK-NEXT: set_local 2, pop{{$}}
5960 define double @fabs64(double %x) {
6061 %a = call double @llvm.fabs.f64(double %x)
6162 ret double %a
6263 }
6364
6465 ; CHECK-LABEL: fneg64:
65 ; CHECK: neg @1{{$}}
66 ; CHECK-NEXT: set_local @2, pop{{$}}
66 ; CHECK: neg (get_local 1){{$}}
67 ; CHECK-NEXT: set_local 2, pop{{$}}
6768 define double @fneg64(double %x) {
6869 %a = fsub double -0., %x
6970 ret double %a
7071 }
7172
7273 ; CHECK-LABEL: copysign64:
73 ; CHECK: copysign @3, @2{{$}}
74 ; CHECK-NEXT: set_local @4, pop{{$}}
74 ; CHECK: copysign (get_local 3), (get_local 2){{$}}
75 ; CHECK-NEXT: set_local 4, pop{{$}}
7576 define double @copysign64(double %x, double %y) {
7677 %a = call double @llvm.copysign.f64(double %x, double %y)
7778 ret double %a
7879 }
7980
8081 ; CHECK-LABEL: sqrt64:
81 ; CHECK: sqrt @1{{$}}
82 ; CHECK-NEXT: set_local @2, pop{{$}}
82 ; CHECK: sqrt (get_local 1){{$}}
83 ; CHECK-NEXT: set_local 2, pop{{$}}
8384 define double @sqrt64(double %x) {
8485 %a = call double @llvm.sqrt.f64(double %x)
8586 ret double %a
8687 }
8788
8889 ; CHECK-LABEL: ceil64:
89 ; CHECK: ceil @1{{$}}
90 ; CHECK-NEXT: set_local @2, pop{{$}}
90 ; CHECK: ceil (get_local 1){{$}}
91 ; CHECK-NEXT: set_local 2, pop{{$}}
9192 define double @ceil64(double %x) {
9293 %a = call double @llvm.ceil.f64(double %x)
9394 ret double %a
9495 }
9596
9697 ; CHECK-LABEL: floor64:
97 ; CHECK: floor @1{{$}}
98 ; CHECK-NEXT: set_local @2, pop{{$}}
98 ; CHECK: floor (get_local 1){{$}}
99 ; CHECK-NEXT: set_local 2, pop{{$}}
99100 define double @floor64(double %x) {
100101 %a = call double @llvm.floor.f64(double %x)
101102 ret double %a
102103 }
103104
104105 ; CHECK-LABEL: trunc64:
105 ; CHECK: trunc @1{{$}}
106 ; CHECK-NEXT: set_local @2, pop{{$}}
106 ; CHECK: trunc (get_local 1){{$}}
107 ; CHECK-NEXT: set_local 2, pop{{$}}
107108 define double @trunc64(double %x) {
108109 %a = call double @llvm.trunc.f64(double %x)
109110 ret double %a
110111 }
111112
112113 ; CHECK-LABEL: nearest64:
113 ; CHECK: nearest @1{{$}}
114 ; CHECK-NEXT: set_local @2, pop{{$}}
114 ; CHECK: nearest (get_local 1){{$}}
115 ; CHECK-NEXT: set_local 2, pop{{$}}
115116 define double @nearest64(double %x) {
116117 %a = call double @llvm.nearbyint.f64(double %x)
117118 ret double %a
118119 }
119120
120121 ; CHECK-LABEL: nearest64_via_rint:
121 ; CHECK: nearest @1{{$}}
122 ; CHECK-NEXT: set_local @2, pop{{$}}
122 ; CHECK: nearest (get_local 1){{$}}
123 ; CHECK-NEXT: set_local 2, pop{{$}}
123124 define double @nearest64_via_rint(double %x) {
124125 %a = call double @llvm.rint.f64(double %x)
125126 ret double %a
1313
1414 ; CHECK-LABEL: f1:
1515 ; CHECK-NEXT: .result i32{{$}}
16 ; CHECK-NEXT: .local i32{{$}}
1617 ; CHECK-NEXT: i32.const 0{{$}}
17 ; CHECK-NEXT: set_local @0, pop{{$}}
18 ; CHECK-NEXT: return @0{{$}}
18 ; CHECK-NEXT: set_local 0, pop{{$}}
19 ; CHECK-NEXT: i32.return (get_local 0){{$}}
1920 ; CHECK: .size f1,
2021 define i32 @f1() {
2122 ret i32 0
2526 ; CHECK-NEXT: .param i32{{$}}
2627 ; CHECK-NEXT: .param f32{{$}}
2728 ; CHECK-NEXT: .result i32{{$}}
29 ; CHECK-NEXT: .local i32{{$}}
2830 ; CHECK-NEXT: i32.const 0{{$}}
29 ; CHECK-NEXT: set_local @2, pop{{$}}
30 ; CHECK-NEXT: return @2{{$}}
31 ; CHECK-NEXT: set_local 2, pop{{$}}
32 ; CHECK-NEXT: i32.return (get_local 2){{$}}
3133 ; CHECK: .size f2,
3234 define i32 @f2(i32 %p1, float %p2) {
3335 ret i32 0
3638 ; CHECK-LABEL: f3:
3739 ; CHECK-NEXT: .param i32{{$}}
3840 ; CHECK-NEXT: .param f32{{$}}
39 ; CHECK-NEXT: return{{$}}
41 ; CHECK-NOT: .local
42 ; CHECK-NEXT: void.return{{$}}
4043 ; CHECK: .size f3,
4144 define void @f3(i32 %p1, float %p2) {
4245 ret void
1212 ; CHECK-NEXT: .param i32{{$}}
1313 ; CHECK-NEXT: .param i32{{$}}
1414 ; CHECK-NEXT: .result i32{{$}}
15 ; CHECK-NEXT: @1{{$}}
16 ; CHECK-NEXT: set_local @2, pop{{$}}
17 ; CHECK-NEXT: @0{{$}}
18 ; CHECK-NEXT: set_local @3, pop{{$}}
19 ; CHECK-NEXT: add @3, @2{{$}}
20 ; CHECK-NEXT: set_local @4, pop{{$}}
21 ; CHECK-NEXT: return @4{{$}}
15 ; CHECK-NEXT: .local i32, i32, i32{{$}}
16 ; CHECK-NEXT: get_local 1{{$}}
17 ; CHECK-NEXT: set_local 2, pop{{$}}
18 ; CHECK-NEXT: get_local 0{{$}}
19 ; CHECK-NEXT: set_local 3, pop{{$}}
20 ; CHECK-NEXT: add (get_local 3), (get_local 2){{$}}
21 ; CHECK-NEXT: set_local 4, pop{{$}}
22 ; CHECK-NEXT: return (get_local 4){{$}}
2223 define i32 @add32(i32 %x, i32 %y) {
2324 %a = add i32 %x, %y
2425 ret i32 %a
2829 ; CHECK-NEXT: .param i32{{$}}
2930 ; CHECK-NEXT: .param i32{{$}}
3031 ; CHECK-NEXT: .result i32{{$}}
31 ; CHECK-NEXT: @1{{$}}
32 ; CHECK-NEXT: set_local @2, pop{{$}}
33 ; CHECK-NEXT: @0{{$}}
34 ; CHECK-NEXT: set_local @3, pop{{$}}
35 ; CHECK-NEXT: sub @3, @2{{$}}
36 ; CHECK-NEXT: set_local @4, pop{{$}}
37 ; CHECK-NEXT: return @4{{$}}
32 ; CHECK-NEXT: .local i32, i32, i32{{$}}
33 ; CHECK-NEXT: get_local 1{{$}}
34 ; CHECK-NEXT: set_local 2, pop{{$}}
35 ; CHECK-NEXT: get_local 0{{$}}
36 ; CHECK-NEXT: set_local 3, pop{{$}}
37 ; CHECK-NEXT: sub (get_local 3), (get_local 2){{$}}
38 ; CHECK-NEXT: set_local 4, pop{{$}}
39 ; CHECK-NEXT: return (get_local 4){{$}}
3840 define i32 @sub32(i32 %x, i32 %y) {
3941 %a = sub i32 %x, %y
4042 ret i32 %a
4446 ; CHECK-NEXT: .param i32{{$}}
4547 ; CHECK-NEXT: .param i32{{$}}
4648 ; CHECK-NEXT: .result i32{{$}}
47 ; CHECK-NEXT: @1{{$}}
48 ; CHECK-NEXT: set_local @2, pop{{$}}
49 ; CHECK-NEXT: @0{{$}}
50 ; CHECK-NEXT: set_local @3, pop{{$}}
51 ; CHECK-NEXT: mul @3, @2{{$}}
52 ; CHECK-NEXT: set_local @4, pop{{$}}
53 ; CHECK-NEXT: return @4{{$}}
49 ; CHECK-NEXT: .local i32, i32, i32{{$}}
50 ; CHECK-NEXT: get_local 1{{$}}
51 ; CHECK-NEXT: set_local 2, pop{{$}}
52 ; CHECK-NEXT: get_local 0{{$}}
53 ; CHECK-NEXT: set_local 3, pop{{$}}
54 ; CHECK-NEXT: mul (get_local 3), (get_local 2){{$}}
55 ; CHECK-NEXT: set_local 4, pop{{$}}
56 ; CHECK-NEXT: return (get_local 4){{$}}
5457 define i32 @mul32(i32 %x, i32 %y) {
5558 %a = mul i32 %x, %y
5659 ret i32 %a
6063 ; CHECK-NEXT: .param i32{{$}}
6164 ; CHECK-NEXT: .param i32{{$}}
6265 ; CHECK-NEXT: .result i32{{$}}
63 ; CHECK-NEXT: @1{{$}}
64 ; CHECK-NEXT: set_local @2, pop{{$}}
65 ; CHECK-NEXT: @0{{$}}
66 ; CHECK-NEXT: set_local @3, pop{{$}}
67 ; CHECK-NEXT: sdiv @3, @2{{$}}
68 ; CHECK-NEXT: set_local @4, pop{{$}}
69 ; CHECK-NEXT: return @4{{$}}
66 ; CHECK-NEXT: .local i32, i32, i32{{$}}
67 ; CHECK-NEXT: get_local 1{{$}}
68 ; CHECK-NEXT: set_local 2, pop{{$}}
69 ; CHECK-NEXT: get_local 0{{$}}
70 ; CHECK-NEXT: set_local 3, pop{{$}}
71 ; CHECK-NEXT: sdiv (get_local 3), (get_local 2){{$}}
72 ; CHECK-NEXT: set_local 4, pop{{$}}
73 ; CHECK-NEXT: return (get_local 4){{$}}
7074 define i32 @sdiv32(i32 %x, i32 %y) {
7175 %a = sdiv i32 %x, %y
7276 ret i32 %a
7680 ; CHECK-NEXT: .param i32{{$}}
7781 ; CHECK-NEXT: .param i32{{$}}
7882 ; CHECK-NEXT: .result i32{{$}}
79 ; CHECK-NEXT: @1{{$}}
80 ; CHECK-NEXT: set_local @2, pop{{$}}
81 ; CHECK-NEXT: @0{{$}}
82 ; CHECK-NEXT: set_local @3, pop{{$}}
83 ; CHECK-NEXT: udiv @3, @2{{$}}
84 ; CHECK-NEXT: set_local @4, pop{{$}}
85 ; CHECK-NEXT: return @4{{$}}
83 ; CHECK-NEXT: .local i32, i32, i32{{$}}
84 ; CHECK-NEXT: get_local 1{{$}}
85 ; CHECK-NEXT: set_local 2, pop{{$}}
86 ; CHECK-NEXT: get_local 0{{$}}
87 ; CHECK-NEXT: set_local 3, pop{{$}}
88 ; CHECK-NEXT: udiv (get_local 3), (get_local 2){{$}}
89 ; CHECK-NEXT: set_local 4, pop{{$}}
90 ; CHECK-NEXT: return (get_local 4){{$}}
8691 define i32 @udiv32(i32 %x, i32 %y) {
8792 %a = udiv i32 %x, %y
8893 ret i32 %a
9297 ; CHECK-NEXT: .param i32{{$}}
9398 ; CHECK-NEXT: .param i32{{$}}
9499 ; CHECK-NEXT: .result i32{{$}}
95 ; CHECK-NEXT: @1{{$}}
96 ; CHECK-NEXT: set_local @2, pop{{$}}
97 ; CHECK-NEXT: @0{{$}}
98 ; CHECK-NEXT: set_local @3, pop{{$}}
99 ; CHECK-NEXT: srem @3, @2{{$}}
100 ; CHECK-NEXT: set_local @4, pop{{$}}
101 ; CHECK-NEXT: return @4{{$}}
100 ; CHECK-NEXT: .local i32, i32, i32{{$}}
101 ; CHECK-NEXT: get_local 1{{$}}
102 ; CHECK-NEXT: set_local 2, pop{{$}}
103 ; CHECK-NEXT: get_local 0{{$}}
104 ; CHECK-NEXT: set_local 3, pop{{$}}
105 ; CHECK-NEXT: srem (get_local 3), (get_local 2){{$}}
106 ; CHECK-NEXT: set_local 4, pop{{$}}
107 ; CHECK-NEXT: return (get_local 4){{$}}
102108 define i32 @srem32(i32 %x, i32 %y) {
103109 %a = srem i32 %x, %y
104110 ret i32 %a
108114 ; CHECK-NEXT: .param i32{{$}}
109115 ; CHECK-NEXT: .param i32{{$}}
110116 ; CHECK-NEXT: .result i32{{$}}
111 ; CHECK-NEXT: @1{{$}}
112 ; CHECK-NEXT: set_local @2, pop{{$}}
113 ; CHECK-NEXT: @0{{$}}
114 ; CHECK-NEXT: set_local @3, pop{{$}}
115 ; CHECK-NEXT: urem @3, @2{{$}}
116 ; CHECK-NEXT: set_local @4, pop{{$}}
117 ; CHECK-NEXT: return @4{{$}}
117 ; CHECK-NEXT: .local i32, i32, i32{{$}}
118 ; CHECK-NEXT: get_local 1{{$}}
119 ; CHECK-NEXT: set_local 2, pop{{$}}
120 ; CHECK-NEXT: get_local 0{{$}}
121 ; CHECK-NEXT: set_local 3, pop{{$}}
122 ; CHECK-NEXT: urem (get_local 3), (get_local 2){{$}}
123 ; CHECK-NEXT: set_local 4, pop{{$}}
124 ; CHECK-NEXT: return (get_local 4){{$}}
118125 define i32 @urem32(i32 %x, i32 %y) {
119126 %a = urem i32 %x, %y
120127 ret i32 %a
124131 ; CHECK-NEXT: .param i32{{$}}
125132 ; CHECK-NEXT: .param i32{{$}}
126133 ; CHECK-NEXT: .result i32{{$}}
127 ; CHECK-NEXT: @1{{$}}
128 ; CHECK-NEXT: set_local @2, pop{{$}}
129 ; CHECK-NEXT: @0{{$}}
130 ; CHECK-NEXT: set_local @3, pop{{$}}
131 ; CHECK-NEXT: and @3, @2{{$}}
132 ; CHECK-NEXT: set_local @4, pop{{$}}
133 ; CHECK-NEXT: return @4{{$}}
134 ; CHECK-NEXT: .local i32, i32, i32{{$}}
135 ; CHECK-NEXT: get_local 1{{$}}
136 ; CHECK-NEXT: set_local 2, pop{{$}}
137 ; CHECK-NEXT: get_local 0{{$}}
138 ; CHECK-NEXT: set_local 3, pop{{$}}
139 ; CHECK-NEXT: and (get_local 3), (get_local 2){{$}}
140 ; CHECK-NEXT: set_local 4, pop{{$}}
141 ; CHECK-NEXT: return (get_local 4){{$}}
134142 define i32 @and32(i32 %x, i32 %y) {
135143 %a = and i32 %x, %y
136144 ret i32 %a
140148 ; CHECK-NEXT: .param i32{{$}}
141149 ; CHECK-NEXT: .param i32{{$}}
142150 ; CHECK-NEXT: .result i32{{$}}
143 ; CHECK-NEXT: @1{{$}}
144 ; CHECK-NEXT: set_local @2, pop{{$}}
145 ; CHECK-NEXT: @0{{$}}
146 ; CHECK-NEXT: set_local @3, pop{{$}}
147 ; CHECK-NEXT: ior @3, @2{{$}}
148 ; CHECK-NEXT: set_local @4, pop{{$}}
149 ; CHECK-NEXT: return @4{{$}}
151 ; CHECK-NEXT: .local i32, i32, i32{{$}}
152 ; CHECK-NEXT: get_local 1{{$}}
153 ; CHECK-NEXT: set_local 2, pop{{$}}
154 ; CHECK-NEXT: get_local 0{{$}}
155 ; CHECK-NEXT: set_local 3, pop{{$}}
156 ; CHECK-NEXT: ior (get_local 3), (get_local 2){{$}}
157 ; CHECK-NEXT: set_local 4, pop{{$}}
158 ; CHECK-NEXT: return (get_local 4){{$}}
150159 define i32 @ior32(i32 %x, i32 %y) {
151160 %a = or i32 %x, %y
152161 ret i32 %a
156165 ; CHECK-NEXT: .param i32{{$}}
157166 ; CHECK-NEXT: .param i32{{$}}
158167 ; CHECK-NEXT: .result i32{{$}}
159 ; CHECK-NEXT: @1{{$}}
160 ; CHECK-NEXT: set_local @2, pop{{$}}
161 ; CHECK-NEXT: @0{{$}}
162 ; CHECK-NEXT: set_local @3, pop{{$}}
163 ; CHECK-NEXT: xor @3, @2{{$}}
164 ; CHECK-NEXT: set_local @4, pop{{$}}
165 ; CHECK-NEXT: return @4{{$}}
168 ; CHECK-NEXT: .local i32, i32, i32{{$}}
169 ; CHECK-NEXT: get_local 1{{$}}
170 ; CHECK-NEXT: set_local 2, pop{{$}}
171 ; CHECK-NEXT: get_local 0{{$}}
172 ; CHECK-NEXT: set_local 3, pop{{$}}
173 ; CHECK-NEXT: xor (get_local 3), (get_local 2){{$}}
174 ; CHECK-NEXT: set_local 4, pop{{$}}
175 ; CHECK-NEXT: return (get_local 4){{$}}
166176 define i32 @xor32(i32 %x, i32 %y) {
167177 %a = xor i32 %x, %y
168178 ret i32 %a
172182 ; CHECK-NEXT: .param i32{{$}}
173183 ; CHECK-NEXT: .param i32{{$}}
174184 ; CHECK-NEXT: .result i32{{$}}
175 ; CHECK-NEXT: @1{{$}}
176 ; CHECK-NEXT: set_local @2, pop{{$}}
177 ; CHECK-NEXT: @0{{$}}
178 ; CHECK-NEXT: set_local @3, pop{{$}}
179 ; CHECK-NEXT: shl @3, @2{{$}}
180 ; CHECK-NEXT: set_local @4, pop{{$}}
181 ; CHECK-NEXT: return @4{{$}}
185 ; CHECK-NEXT: .local i32, i32, i32{{$}}
186 ; CHECK-NEXT: get_local 1{{$}}
187 ; CHECK-NEXT: set_local 2, pop{{$}}
188 ; CHECK-NEXT: get_local 0{{$}}
189 ; CHECK-NEXT: set_local 3, pop{{$}}
190 ; CHECK-NEXT: shl (get_local 3), (get_local 2){{$}}
191 ; CHECK-NEXT: set_local 4, pop{{$}}
192 ; CHECK-NEXT: return (get_local 4){{$}}
182193 define i32 @shl32(i32 %x, i32 %y) {
183194 %a = shl i32 %x, %y
184195 ret i32 %a
188199 ; CHECK-NEXT: .param i32{{$}}
189200 ; CHECK-NEXT: .param i32{{$}}
190201 ; CHECK-NEXT: .result i32{{$}}
191 ; CHECK-NEXT: @1{{$}}
192 ; CHECK-NEXT: set_local @2, pop{{$}}
193 ; CHECK-NEXT: @0{{$}}
194 ; CHECK-NEXT: set_local @3, pop{{$}}
195 ; CHECK-NEXT: shr_u @3, @2{{$}}
196 ; CHECK-NEXT: set_local @4, pop{{$}}
197 ; CHECK-NEXT: return @4{{$}}
202 ; CHECK-NEXT: .local i32, i32, i32{{$}}
203 ; CHECK-NEXT: get_local 1{{$}}
204 ; CHECK-NEXT: set_local 2, pop{{$}}
205 ; CHECK-NEXT: get_local 0{{$}}
206 ; CHECK-NEXT: set_local 3, pop{{$}}
207 ; CHECK-NEXT: shr_u (get_local 3), (get_local 2){{$}}
208 ; CHECK-NEXT: set_local 4, pop{{$}}
209 ; CHECK-NEXT: return (get_local 4){{$}}
198210 define i32 @shr32(i32 %x, i32 %y) {
199211 %a = lshr i32 %x, %y
200212 ret i32 %a
204216 ; CHECK-NEXT: .param i32{{$}}
205217 ; CHECK-NEXT: .param i32{{$}}
206218 ; CHECK-NEXT: .result i32{{$}}
207 ; CHECK-NEXT: @1{{$}}
208 ; CHECK-NEXT: set_local @2, pop{{$}}
209 ; CHECK-NEXT: @0{{$}}
210 ; CHECK-NEXT: set_local @3, pop{{$}}
211 ; CHECK-NEXT: shr_s @3, @2{{$}}
212 ; CHECK-NEXT: set_local @4, pop{{$}}
213 ; CHECK-NEXT: return @4{{$}}
219 ; CHECK-NEXT: .local i32, i32, i32{{$}}
220 ; CHECK-NEXT: get_local 1{{$}}
221 ; CHECK-NEXT: set_local 2, pop{{$}}
222 ; CHECK-NEXT: get_local 0{{$}}
223 ; CHECK-NEXT: set_local 3, pop{{$}}
224 ; CHECK-NEXT: shr_s (get_local 3), (get_local 2){{$}}
225 ; CHECK-NEXT: set_local 4, pop{{$}}
226 ; CHECK-NEXT: return (get_local 4){{$}}
214227 define i32 @sar32(i32 %x, i32 %y) {
215228 %a = ashr i32 %x, %y
216229 ret i32 %a
219232 ; CHECK-LABEL: clz32:
220233 ; CHECK-NEXT: .param i32{{$}}
221234 ; CHECK-NEXT: .result i32{{$}}
222 ; CHECK-NEXT: @0{{$}}
223 ; CHECK-NEXT: set_local @1, pop{{$}}
224 ; CHECK-NEXT: clz @1{{$}}
225 ; CHECK-NEXT: set_local @2, pop{{$}}
226 ; CHECK-NEXT: return @2{{$}}
235 ; CHECK-NEXT: .local i32, i32{{$}}
236 ; CHECK-NEXT: get_local 0{{$}}
237 ; CHECK-NEXT: set_local 1, pop{{$}}
238 ; CHECK-NEXT: clz (get_local 1){{$}}
239 ; CHECK-NEXT: set_local 2, pop{{$}}
240 ; CHECK-NEXT: return (get_local 2){{$}}
227241 define i32 @clz32(i32 %x) {
228242 %a = call i32 @llvm.ctlz.i32(i32 %x, i1 false)
229243 ret i32 %a
232246 ; CHECK-LABEL: clz32_zero_undef:
233247 ; CHECK-NEXT: .param i32{{$}}
234248 ; CHECK-NEXT: .result i32{{$}}
235 ; CHECK-NEXT: @0{{$}}
236 ; CHECK-NEXT: set_local @1, pop{{$}}
237 ; CHECK-NEXT: clz @1{{$}}
238 ; CHECK-NEXT: set_local @2, pop{{$}}
239 ; CHECK-NEXT: return @2{{$}}
249 ; CHECK-NEXT: .local i32, i32{{$}}
250 ; CHECK-NEXT: get_local 0{{$}}
251 ; CHECK-NEXT: set_local 1, pop{{$}}
252 ; CHECK-NEXT: clz (get_local 1){{$}}
253 ; CHECK-NEXT: set_local 2, pop{{$}}
254 ; CHECK-NEXT: return (get_local 2){{$}}
240255 define i32 @clz32_zero_undef(i32 %x) {
241256 %a = call i32 @llvm.ctlz.i32(i32 %x, i1 true)
242257 ret i32 %a
245260 ; CHECK-LABEL: ctz32:
246261 ; CHECK-NEXT: .param i32{{$}}
247262 ; CHECK-NEXT: .result i32{{$}}
248 ; CHECK-NEXT: @0{{$}}
249 ; CHECK-NEXT: set_local @1, pop{{$}}
250 ; CHECK-NEXT: ctz @1{{$}}
251 ; CHECK-NEXT: set_local @2, pop{{$}}
252 ; CHECK-NEXT: return @2{{$}}
263 ; CHECK-NEXT: .local i32, i32{{$}}
264 ; CHECK-NEXT: get_local 0{{$}}
265 ; CHECK-NEXT: set_local 1, pop{{$}}
266 ; CHECK-NEXT: ctz (get_local 1){{$}}
267 ; CHECK-NEXT: set_local 2, pop{{$}}
268 ; CHECK-NEXT: return (get_local 2){{$}}
253269 define i32 @ctz32(i32 %x) {
254270 %a = call i32 @llvm.cttz.i32(i32 %x, i1 false)
255271 ret i32 %a
258274 ; CHECK-LABEL: ctz32_zero_undef:
259275 ; CHECK-NEXT: .param i32{{$}}
260276 ; CHECK-NEXT: .result i32{{$}}
261 ; CHECK-NEXT: @0{{$}}
262 ; CHECK-NEXT: set_local @1, pop{{$}}
263 ; CHECK-NEXT: ctz @1{{$}}
264 ; CHECK-NEXT: set_local @2, pop{{$}}
265 ; CHECK-NEXT: return @2{{$}}
277 ; CHECK-NEXT: .local i32, i32{{$}}
278 ; CHECK-NEXT: get_local 0{{$}}
279 ; CHECK-NEXT: set_local 1, pop{{$}}
280 ; CHECK-NEXT: ctz (get_local 1){{$}}
281 ; CHECK-NEXT: set_local 2, pop{{$}}
282 ; CHECK-NEXT: return (get_local 2){{$}}
266283 define i32 @ctz32_zero_undef(i32 %x) {
267284 %a = call i32 @llvm.cttz.i32(i32 %x, i1 true)
268285 ret i32 %a
271288 ; CHECK-LABEL: popcnt32:
272289 ; CHECK-NEXT: .param i32{{$}}
273290 ; CHECK-NEXT: .result i32{{$}}
274 ; CHECK-NEXT: @0{{$}}
275 ; CHECK-NEXT: set_local @1, pop{{$}}
276 ; CHECK-NEXT: popcnt @1{{$}}
277 ; CHECK-NEXT: set_local @2, pop{{$}}
278 ; CHECK-NEXT: return @2{{$}}
291 ; CHECK-NEXT: .local i32, i32{{$}}
292 ; CHECK-NEXT: get_local 0{{$}}
293 ; CHECK-NEXT: set_local 1, pop{{$}}
294 ; CHECK-NEXT: popcnt (get_local 1){{$}}
295 ; CHECK-NEXT: set_local 2, pop{{$}}
296 ; CHECK-NEXT: return (get_local 2){{$}}
279297 define i32 @popcnt32(i32 %x) {
280298 %a = call i32 @llvm.ctpop.i32(i32 %x)
281299 ret i32 %a
1212 ; CHECK-NEXT: .param i64{{$}}
1313 ; CHECK-NEXT: .param i64{{$}}
1414 ; CHECK-NEXT: .result i64{{$}}
15 ; CHECK-NEXT: @1{{$}}
16 ; CHECK-NEXT: set_local @2, pop{{$}}
17 ; CHECK-NEXT: @0{{$}}
18 ; CHECK-NEXT: set_local @3, pop{{$}}
19 ; CHECK-NEXT: add @3, @2{{$}}
20 ; CHECK-NEXT: set_local @4, pop{{$}}
21 ; CHECK-NEXT: return @4{{$}}
15 ; CHECK-NEXT: .local i64, i64, i64{{$}}
16 ; CHECK-NEXT: get_local 1{{$}}
17 ; CHECK-NEXT: set_local 2, pop{{$}}
18 ; CHECK-NEXT: get_local 0{{$}}
19 ; CHECK-NEXT: set_local 3, pop{{$}}
20 ; CHECK-NEXT: add (get_local 3), (get_local 2){{$}}
21 ; CHECK-NEXT: set_local 4, pop{{$}}
22 ; CHECK-NEXT: return (get_local 4){{$}}
2223 define i64 @add64(i64 %x, i64 %y) {
2324 %a = add i64 %x, %y
2425 ret i64 %a
2829 ; CHECK-NEXT: .param i64{{$}}
2930 ; CHECK-NEXT: .param i64{{$}}
3031 ; CHECK-NEXT: .result i64{{$}}
31 ; CHECK-NEXT: @1{{$}}
32 ; CHECK-NEXT: set_local @2, pop{{$}}
33 ; CHECK-NEXT: @0{{$}}
34 ; CHECK-NEXT: set_local @3, pop{{$}}
35 ; CHECK-NEXT: sub @3, @2{{$}}
36 ; CHECK-NEXT: set_local @4, pop{{$}}
37 ; CHECK-NEXT: return @4{{$}}
32 ; CHECK-NEXT: .local i64, i64, i64{{$}}
33 ; CHECK-NEXT: get_local 1{{$}}
34 ; CHECK-NEXT: set_local 2, pop{{$}}
35 ; CHECK-NEXT: get_local 0{{$}}
36 ; CHECK-NEXT: set_local 3, pop{{$}}
37 ; CHECK-NEXT: sub (get_local 3), (get_local 2){{$}}
38 ; CHECK-NEXT: set_local 4, pop{{$}}
39 ; CHECK-NEXT: return (get_local 4){{$}}
3840 define i64 @sub64(i64 %x, i64 %y) {
3941 %a = sub i64 %x, %y
4042 ret i64 %a
4446 ; CHECK-NEXT: .param i64{{$}}
4547 ; CHECK-NEXT: .param i64{{$}}
4648 ; CHECK-NEXT: .result i64{{$}}
47 ; CHECK-NEXT: @1{{$}}
48 ; CHECK-NEXT: set_local @2, pop{{$}}
49 ; CHECK-NEXT: @0{{$}}
50 ; CHECK-NEXT: set_local @3, pop{{$}}
51 ; CHECK-NEXT: mul @3, @2{{$}}
52 ; CHECK-NEXT: set_local @4, pop{{$}}
53 ; CHECK-NEXT: return @4{{$}}
49 ; CHECK-NEXT: .local i64, i64, i64{{$}}
50 ; CHECK-NEXT: get_local 1{{$}}
51 ; CHECK-NEXT: set_local 2, pop{{$}}
52 ; CHECK-NEXT: get_local 0{{$}}
53 ; CHECK-NEXT: set_local 3, pop{{$}}
54 ; CHECK-NEXT: mul (get_local 3), (get_local 2){{$}}
55 ; CHECK-NEXT: set_local 4, pop{{$}}
56 ; CHECK-NEXT: return (get_local 4){{$}}
5457 define i64 @mul64(i64 %x, i64 %y) {
5558 %a = mul i64 %x, %y
5659 ret i64 %a
6063 ; CHECK-NEXT: .param i64{{$}}
6164 ; CHECK-NEXT: .param i64{{$}}
6265 ; CHECK-NEXT: .result i64{{$}}
63 ; CHECK-NEXT: @1{{$}}
64 ; CHECK-NEXT: set_local @2, pop{{$}}
65 ; CHECK-NEXT: @0{{$}}
66 ; CHECK-NEXT: set_local @3, pop{{$}}
67 ; CHECK-NEXT: sdiv @3, @2{{$}}
68 ; CHECK-NEXT: set_local @4, pop{{$}}
69 ; CHECK-NEXT: return @4{{$}}
66 ; CHECK-NEXT: .local i64, i64, i64{{$}}
67 ; CHECK-NEXT: get_local 1{{$}}
68 ; CHECK-NEXT: set_local 2, pop{{$}}
69 ; CHECK-NEXT: get_local 0{{$}}
70 ; CHECK-NEXT: set_local 3, pop{{$}}
71 ; CHECK-NEXT: sdiv (get_local 3), (get_local 2){{$}}
72 ; CHECK-NEXT: set_local 4, pop{{$}}
73 ; CHECK-NEXT: return (get_local 4){{$}}
7074 define i64 @sdiv64(i64 %x, i64 %y) {
7175 %a = sdiv i64 %x, %y
7276 ret i64 %a
7680 ; CHECK-NEXT: .param i64{{$}}
7781 ; CHECK-NEXT: .param i64{{$}}
7882 ; CHECK-NEXT: .result i64{{$}}
79 ; CHECK-NEXT: @1{{$}}
80 ; CHECK-NEXT: set_local @2, pop{{$}}
81 ; CHECK-NEXT: @0{{$}}
82 ; CHECK-NEXT: set_local @3, pop{{$}}
83 ; CHECK-NEXT: udiv @3, @2{{$}}
84 ; CHECK-NEXT: set_local @4, pop{{$}}
85 ; CHECK-NEXT: return @4{{$}}
83 ; CHECK-NEXT: .local i64, i64, i64{{$}}
84 ; CHECK-NEXT: get_local 1{{$}}
85 ; CHECK-NEXT: set_local 2, pop{{$}}
86 ; CHECK-NEXT: get_local 0{{$}}
87 ; CHECK-NEXT: set_local 3, pop{{$}}
88 ; CHECK-NEXT: udiv (get_local 3), (get_local 2){{$}}
89 ; CHECK-NEXT: set_local 4, pop{{$}}
90 ; CHECK-NEXT: return (get_local 4){{$}}
8691 define i64 @udiv64(i64 %x, i64 %y) {
8792 %a = udiv i64 %x, %y
8893 ret i64 %a
9297 ; CHECK-NEXT: .param i64{{$}}
9398 ; CHECK-NEXT: .param i64{{$}}
9499 ; CHECK-NEXT: .result i64{{$}}
95 ; CHECK-NEXT: @1{{$}}
96 ; CHECK-NEXT: set_local @2, pop{{$}}
97 ; CHECK-NEXT: @0{{$}}
98 ; CHECK-NEXT: set_local @3, pop{{$}}
99 ; CHECK-NEXT: srem @3, @2{{$}}
100 ; CHECK-NEXT: set_local @4, pop{{$}}
101 ; CHECK-NEXT: return @4{{$}}
100 ; CHECK-NEXT: .local i64, i64, i64{{$}}
101 ; CHECK-NEXT: get_local 1{{$}}
102 ; CHECK-NEXT: set_local 2, pop{{$}}
103 ; CHECK-NEXT: get_local 0{{$}}
104 ; CHECK-NEXT: set_local 3, pop{{$}}
105 ; CHECK-NEXT: srem (get_local 3), (get_local 2){{$}}
106 ; CHECK-NEXT: set_local 4, pop{{$}}
107 ; CHECK-NEXT: return (get_local 4){{$}}
102108 define i64 @srem64(i64 %x, i64 %y) {
103109 %a = srem i64 %x, %y
104110 ret i64 %a
108114 ; CHECK-NEXT: .param i64{{$}}
109115 ; CHECK-NEXT: .param i64{{$}}
110116 ; CHECK-NEXT: .result i64{{$}}
111 ; CHECK-NEXT: @1{{$}}
112 ; CHECK-NEXT: set_local @2, pop{{$}}
113 ; CHECK-NEXT: @0{{$}}
114 ; CHECK-NEXT: set_local @3, pop{{$}}
115 ; CHECK-NEXT: urem @3, @2{{$}}
116 ; CHECK-NEXT: set_local @4, pop{{$}}
117 ; CHECK-NEXT: return @4{{$}}
117 ; CHECK-NEXT: .local i64, i64, i64{{$}}
118 ; CHECK-NEXT: get_local 1{{$}}
119 ; CHECK-NEXT: set_local 2, pop{{$}}
120 ; CHECK-NEXT: get_local 0{{$}}
121 ; CHECK-NEXT: set_local 3, pop{{$}}
122 ; CHECK-NEXT: urem (get_local 3), (get_local 2){{$}}
123 ; CHECK-NEXT: set_local 4, pop{{$}}
124 ; CHECK-NEXT: return (get_local 4){{$}}
118125 define i64 @urem64(i64 %x, i64 %y) {
119126 %a = urem i64 %x, %y
120127 ret i64 %a
124131 ; CHECK-NEXT: .param i64{{$}}
125132 ; CHECK-NEXT: .param i64{{$}}
126133 ; CHECK-NEXT: .result i64{{$}}
127 ; CHECK-NEXT: @1{{$}}
128 ; CHECK-NEXT: set_local @2, pop{{$}}
129 ; CHECK-NEXT: @0{{$}}
130 ; CHECK-NEXT: set_local @3, pop{{$}}
131 ; CHECK-NEXT: and @3, @2{{$}}
132 ; CHECK-NEXT: set_local @4, pop{{$}}
133 ; CHECK-NEXT: return @4{{$}}
134 ; CHECK-NEXT: .local i64, i64, i64{{$}}
135 ; CHECK-NEXT: get_local 1{{$}}
136 ; CHECK-NEXT: set_local 2, pop{{$}}
137 ; CHECK-NEXT: get_local 0{{$}}
138 ; CHECK-NEXT: set_local 3, pop{{$}}
139 ; CHECK-NEXT: and (get_local 3), (get_local 2){{$}}
140 ; CHECK-NEXT: set_local 4, pop{{$}}
141 ; CHECK-NEXT: return (get_local 4){{$}}
134142 define i64 @and64(i64 %x, i64 %y) {
135143 %a = and i64 %x, %y
136144 ret i64 %a
140148 ; CHECK-NEXT: .param i64{{$}}
141149 ; CHECK-NEXT: .param i64{{$}}
142150 ; CHECK-NEXT: .result i64{{$}}
143 ; CHECK-NEXT: @1{{$}}
144 ; CHECK-NEXT: set_local @2, pop{{$}}
145 ; CHECK-NEXT: @0{{$}}
146 ; CHECK-NEXT: set_local @3, pop{{$}}
147 ; CHECK-NEXT: ior @3, @2{{$}}
148 ; CHECK-NEXT: set_local @4, pop{{$}}
149 ; CHECK-NEXT: return @4{{$}}
151 ; CHECK-NEXT: .local i64, i64, i64{{$}}
152 ; CHECK-NEXT: get_local 1{{$}}
153 ; CHECK-NEXT: set_local 2, pop{{$}}
154 ; CHECK-NEXT: get_local 0{{$}}
155 ; CHECK-NEXT: set_local 3, pop{{$}}
156 ; CHECK-NEXT: ior (get_local 3), (get_local 2){{$}}
157 ; CHECK-NEXT: set_local 4, pop{{$}}
158 ; CHECK-NEXT: return (get_local 4){{$}}
150159 define i64 @ior64(i64 %x, i64 %y) {
151160 %a = or i64 %x, %y
152161 ret i64 %a
156165 ; CHECK-NEXT: .param i64{{$}}
157166 ; CHECK-NEXT: .param i64{{$}}
158167 ; CHECK-NEXT: .result i64{{$}}
159 ; CHECK-NEXT: @1{{$}}
160 ; CHECK-NEXT: set_local @2, pop{{$}}
161 ; CHECK-NEXT: @0{{$}}
162 ; CHECK-NEXT: set_local @3, pop{{$}}
163 ; CHECK-NEXT: xor @3, @2{{$}}
164 ; CHECK-NEXT: set_local @4, pop{{$}}
165 ; CHECK-NEXT: return @4{{$}}
168 ; CHECK-NEXT: .local i64, i64, i64{{$}}
169 ; CHECK-NEXT: get_local 1{{$}}
170 ; CHECK-NEXT: set_local 2, pop{{$}}
171 ; CHECK-NEXT: get_local 0{{$}}
172 ; CHECK-NEXT: set_local 3, pop{{$}}
173 ; CHECK-NEXT: xor (get_local 3), (get_local 2){{$}}
174 ; CHECK-NEXT: set_local 4, pop{{$}}
175 ; CHECK-NEXT: return (get_local 4){{$}}
166176 define i64 @xor64(i64 %x, i64 %y) {
167177 %a = xor i64 %x, %y
168178 ret i64 %a
172182 ; CHECK-NEXT: .param i64{{$}}
173183 ; CHECK-NEXT: .param i64{{$}}
174184 ; CHECK-NEXT: .result i64{{$}}
175 ; CHECK-NEXT: @1{{$}}
176 ; CHECK-NEXT: set_local @2, pop{{$}}
177 ; CHECK-NEXT: @0{{$}}
178 ; CHECK-NEXT: set_local @3, pop{{$}}
179 ; CHECK-NEXT: shl @3, @2{{$}}
180 ; CHECK-NEXT: set_local @4, pop{{$}}
181 ; CHECK-NEXT: return @4{{$}}
185 ; CHECK-NEXT: .local i64, i64, i64{{$}}
186 ; CHECK-NEXT: get_local 1{{$}}
187 ; CHECK-NEXT: set_local 2, pop{{$}}
188 ; CHECK-NEXT: get_local 0{{$}}
189 ; CHECK-NEXT: set_local 3, pop{{$}}
190 ; CHECK-NEXT: shl (get_local 3), (get_local 2){{$}}
191 ; CHECK-NEXT: set_local 4, pop{{$}}
192 ; CHECK-NEXT: return (get_local 4){{$}}
182193 define i64 @shl64(i64 %x, i64 %y) {
183194 %a = shl i64 %x, %y
184195 ret i64 %a
188199 ; CHECK-NEXT: .param i64{{$}}
189200 ; CHECK-NEXT: .param i64{{$}}
190201 ; CHECK-NEXT: .result i64{{$}}
191 ; CHECK-NEXT: @1{{$}}
192 ; CHECK-NEXT: set_local @2, pop{{$}}
193 ; CHECK-NEXT: @0{{$}}
194 ; CHECK-NEXT: set_local @3, pop{{$}}
195 ; CHECK-NEXT: shr_u @3, @2{{$}}
196 ; CHECK-NEXT: set_local @4, pop{{$}}
197 ; CHECK-NEXT: return @4{{$}}
202 ; CHECK-NEXT: .local i64, i64, i64{{$}}
203 ; CHECK-NEXT: get_local 1{{$}}
204 ; CHECK-NEXT: set_local 2, pop{{$}}
205 ; CHECK-NEXT: get_local 0{{$}}
206 ; CHECK-NEXT: set_local 3, pop{{$}}
207 ; CHECK-NEXT: shr_u (get_local 3), (get_local 2){{$}}
208 ; CHECK-NEXT: set_local 4, pop{{$}}
209 ; CHECK-NEXT: return (get_local 4){{$}}
198210 define i64 @shr64(i64 %x, i64 %y) {
199211 %a = lshr i64 %x, %y
200212 ret i64 %a
204216 ; CHECK-NEXT: .param i64{{$}}
205217 ; CHECK-NEXT: .param i64{{$}}
206218 ; CHECK-NEXT: .result i64{{$}}
207 ; CHECK-NEXT: @1{{$}}
208 ; CHECK-NEXT: set_local @2, pop{{$}}
209 ; CHECK-NEXT: @0{{$}}
210 ; CHECK-NEXT: set_local @3, pop{{$}}
211 ; CHECK-NEXT: shr_s @3, @2{{$}}
212 ; CHECK-NEXT: set_local @4, pop{{$}}
213 ; CHECK-NEXT: return @4{{$}}
219 ; CHECK-NEXT: .local i64, i64, i64{{$}}
220 ; CHECK-NEXT: get_local 1{{$}}
221 ; CHECK-NEXT: set_local 2, pop{{$}}
222 ; CHECK-NEXT: get_local 0{{$}}
223 ; CHECK-NEXT: set_local 3, pop{{$}}
224 ; CHECK-NEXT: shr_s (get_local 3), (get_local 2){{$}}
225 ; CHECK-NEXT: set_local 4, pop{{$}}
226 ; CHECK-NEXT: return (get_local 4){{$}}
214227 define i64 @sar64(i64 %x, i64 %y) {
215228 %a = ashr i64 %x, %y
216229 ret i64 %a
219232 ; CHECK-LABEL: clz64:
220233 ; CHECK-NEXT: .param i64{{$}}
221234 ; CHECK-NEXT: .result i64{{$}}
222 ; CHECK-NEXT: @0{{$}}
223 ; CHECK-NEXT: set_local @1, pop{{$}}
224 ; CHECK-NEXT: clz @1{{$}}
225 ; CHECK-NEXT: set_local @2, pop{{$}}
226 ; CHECK-NEXT: return @2{{$}}
235 ; CHECK-NEXT: .local i64, i64{{$}}
236 ; CHECK-NEXT: get_local 0{{$}}
237 ; CHECK-NEXT: set_local 1, pop{{$}}
238 ; CHECK-NEXT: clz (get_local 1){{$}}
239 ; CHECK-NEXT: set_local 2, pop{{$}}
240 ; CHECK-NEXT: return (get_local 2){{$}}
227241 define i64 @clz64(i64 %x) {
228242 %a = call i64 @llvm.ctlz.i64(i64 %x, i1 false)
229243 ret i64 %a
232246 ; CHECK-LABEL: clz64_zero_undef:
233247 ; CHECK-NEXT: .param i64{{$}}
234248 ; CHECK-NEXT: .result i64{{$}}
235 ; CHECK-NEXT: @0{{$}}
236 ; CHECK-NEXT: set_local @1, pop{{$}}
237 ; CHECK-NEXT: clz @1{{$}}
238 ; CHECK-NEXT: set_local @2, pop{{$}}
239 ; CHECK-NEXT: return @2{{$}}
249 ; CHECK-NEXT: .local i64, i64{{$}}
250 ; CHECK-NEXT: get_local 0{{$}}
251 ; CHECK-NEXT: set_local 1, pop{{$}}
252 ; CHECK-NEXT: clz (get_local 1){{$}}
253 ; CHECK-NEXT: set_local 2, pop{{$}}
254 ; CHECK-NEXT: return (get_local 2){{$}}
240255 define i64 @clz64_zero_undef(i64 %x) {
241256 %a = call i64 @llvm.ctlz.i64(i64 %x, i1 true)
242257 ret i64 %a
245260 ; CHECK-LABEL: ctz64:
246261 ; CHECK-NEXT: .param i64{{$}}
247262 ; CHECK-NEXT: .result i64{{$}}
248 ; CHECK-NEXT: @0{{$}}
249 ; CHECK-NEXT: set_local @1, pop{{$}}
250 ; CHECK-NEXT: ctz @1{{$}}
251 ; CHECK-NEXT: set_local @2, pop{{$}}
252 ; CHECK-NEXT: return @2{{$}}
263 ; CHECK-NEXT: .local i64, i64{{$}}
264 ; CHECK-NEXT: get_local 0{{$}}
265 ; CHECK-NEXT: set_local 1, pop{{$}}
266 ; CHECK-NEXT: ctz (get_local 1){{$}}
267 ; CHECK-NEXT: set_local 2, pop{{$}}
268 ; CHECK-NEXT: return (get_local 2){{$}}
253269 define i64 @ctz64(i64 %x) {
254270 %a = call i64 @llvm.cttz.i64(i64 %x, i1 false)
255271 ret i64 %a
258274 ; CHECK-LABEL: ctz64_zero_undef:
259275 ; CHECK-NEXT: .param i64{{$}}
260276 ; CHECK-NEXT: .result i64{{$}}
261 ; CHECK-NEXT: @0{{$}}
262 ; CHECK-NEXT: set_local @1, pop{{$}}
263 ; CHECK-NEXT: ctz @1{{$}}
264 ; CHECK-NEXT: set_local @2, pop{{$}}
265 ; CHECK-NEXT: return @2{{$}}
277 ; CHECK-NEXT: .local i64, i64{{$}}
278 ; CHECK-NEXT: get_local 0{{$}}
279 ; CHECK-NEXT: set_local 1, pop{{$}}
280 ; CHECK-NEXT: ctz (get_local 1){{$}}
281 ; CHECK-NEXT: set_local 2, pop{{$}}
282 ; CHECK-NEXT: return (get_local 2){{$}}
266283 define i64 @ctz64_zero_undef(i64 %x) {
267284 %a = call i64 @llvm.cttz.i64(i64 %x, i1 true)
268285 ret i64 %a
271288 ; CHECK-LABEL: popcnt64:
272289 ; CHECK-NEXT: .param i64{{$}}
273290 ; CHECK-NEXT: .result i64{{$}}
274 ; CHECK-NEXT: @0{{$}}
275 ; CHECK-NEXT: set_local @1, pop{{$}}
276 ; CHECK-NEXT: popcnt @1{{$}}
277 ; CHECK-NEXT: set_local @2, pop{{$}}
278 ; CHECK-NEXT: return @2{{$}}
291 ; CHECK-NEXT: .local i64, i64{{$}}
292 ; CHECK-NEXT: get_local 0{{$}}
293 ; CHECK-NEXT: set_local 1, pop{{$}}
294 ; CHECK-NEXT: popcnt (get_local 1){{$}}
295 ; CHECK-NEXT: set_local 2, pop{{$}}
296 ; CHECK-NEXT: return (get_local 2){{$}}
279297 define i64 @popcnt64(i64 %x) {
280298 %a = call i64 @llvm.ctpop.i64(i64 %x)
281299 ret i64 %a
66
77 ; CHECK-LABEL: zero_i32:
88 ; CHECK-NEXT: .result i32{{$}}
9 ; CHECK-NEXT: .local
910 ; CHECK-NEXT: i32.const 0{{$}}
10 ; CHECK-NEXT: set_local @0, pop{{$}}
11 ; CHECK-NEXT: return @0{{$}}
11 ; CHECK-NEXT: set_local 0, pop{{$}}
12 ; CHECK-NEXT: return (get_local 0){{$}}
1213 define i32 @zero_i32() {
1314 ret i32 0
1415 }
1516
1617 ; CHECK-LABEL: one_i32:
1718 ; CHECK-NEXT: .result i32{{$}}
19 ; CHECK-NEXT: .local
1820 ; CHECK-NEXT: i32.const 1{{$}}
19 ; CHECK-NEXT: set_local @0, pop{{$}}
20 ; CHECK-NEXT: return @0{{$}}
21 ; CHECK-NEXT: set_local 0, pop{{$}}
22 ; CHECK-NEXT: return (get_local 0){{$}}
2123 define i32 @one_i32() {
2224 ret i32 1
2325 }
2426
2527 ; CHECK-LABEL: max_i32:
2628 ; CHECK-NEXT: .result i32{{$}}
29 ; CHECK-NEXT: .local
2730 ; CHECK-NEXT: i32.const 2147483647{{$}}
28 ; CHECK-NEXT: set_local @0, pop{{$}}
29 ; CHECK-NEXT: return @0{{$}}
31 ; CHECK-NEXT: set_local 0, pop{{$}}
32 ; CHECK-NEXT: return (get_local 0){{$}}
3033 define i32 @max_i32() {
3134 ret i32 2147483647
3235 }
3336
3437 ; CHECK-LABEL: min_i32:
3538 ; CHECK-NEXT: .result i32{{$}}
39 ; CHECK-NEXT: .local
3640 ; CHECK-NEXT: i32.const -2147483648{{$}}
37 ; CHECK-NEXT: set_local @0, pop{{$}}
38 ; CHECK-NEXT: return @0{{$}}
41 ; CHECK-NEXT: set_local 0, pop{{$}}
42 ; CHECK-NEXT: return (get_local 0){{$}}
3943 define i32 @min_i32() {
4044 ret i32 -2147483648
4145 }
4246
4347 ; CHECK-LABEL: zero_i64:
4448 ; CHECK-NEXT: .result i64{{$}}
49 ; CHECK-NEXT: .local
4550 ; CHECK-NEXT: i64.const 0{{$}}
46 ; CHECK-NEXT: set_local @0, pop{{$}}
47 ; CHECK-NEXT: return @0{{$}}
51 ; CHECK-NEXT: set_local 0, pop{{$}}
52 ; CHECK-NEXT: return (get_local 0){{$}}
4853 define i64 @zero_i64() {
4954 ret i64 0
5055 }
5156
5257 ; CHECK-LABEL: one_i64:
5358 ; CHECK-NEXT: .result i64{{$}}
59 ; CHECK-NEXT: .local
5460 ; CHECK-NEXT: i64.const 1{{$}}
55 ; CHECK-NEXT: set_local @0, pop{{$}}
56 ; CHECK-NEXT: return @0{{$}}
61 ; CHECK-NEXT: set_local 0, pop{{$}}
62 ; CHECK-NEXT: return (get_local 0){{$}}
5763 define i64 @one_i64() {
5864 ret i64 1
5965 }
6066
6167 ; CHECK-LABEL: max_i64:
6268 ; CHECK-NEXT: .result i64{{$}}
69 ; CHECK-NEXT: .local
6370 ; CHECK-NEXT: i64.const 9223372036854775807{{$}}
64 ; CHECK-NEXT: set_local @0, pop{{$}}
65 ; CHECK-NEXT: return @0{{$}}
71 ; CHECK-NEXT: set_local 0, pop{{$}}
72 ; CHECK-NEXT: return (get_local 0){{$}}
6673 define i64 @max_i64() {
6774 ret i64 9223372036854775807
6875 }
6976
7077 ; CHECK-LABEL: min_i64:
7178 ; CHECK-NEXT: .result i64{{$}}
79 ; CHECK-NEXT: .local
7280 ; CHECK-NEXT: i64.const -9223372036854775808{{$}}
73 ; CHECK-NEXT: set_local @0, pop{{$}}
74 ; CHECK-NEXT: return @0{{$}}
81 ; CHECK-NEXT: set_local 0, pop{{$}}
82 ; CHECK-NEXT: return (get_local 0){{$}}
7583 define i64 @min_i64() {
7684 ret i64 -9223372036854775808
7785 }
7886
7987 ; CHECK-LABEL: negzero_f32:
8088 ; CHECK-NEXT: .result f32{{$}}
89 ; CHECK-NEXT: .local
8190 ; CHECK-NEXT: f32.const -0x0p0{{$}}
82 ; CHECK-NEXT: set_local @0, pop{{$}}
83 ; CHECK-NEXT: return @0{{$}}
91 ; CHECK-NEXT: set_local 0, pop{{$}}
92 ; CHECK-NEXT: return (get_local 0){{$}}
8493 define float @negzero_f32() {
8594 ret float -0.0
8695 }
8796
8897 ; CHECK-LABEL: zero_f32:
8998 ; CHECK-NEXT: .result f32{{$}}
99 ; CHECK-NEXT: .local
90100 ; CHECK-NEXT: f32.const 0x0p0{{$}}
91 ; CHECK-NEXT: set_local @0, pop{{$}}
92 ; CHECK-NEXT: return @0{{$}}
101 ; CHECK-NEXT: set_local 0, pop{{$}}
102 ; CHECK-NEXT: return (get_local 0){{$}}
93103 define float @zero_f32() {
94104 ret float 0.0
95105 }
96106
97107 ; CHECK-LABEL: one_f32:
98108 ; CHECK-NEXT: .result f32{{$}}
109 ; CHECK-NEXT: .local
99110 ; CHECK-NEXT: f32.const 0x1p0{{$}}
100 ; CHECK-NEXT: set_local @0, pop{{$}}
101 ; CHECK-NEXT: return @0{{$}}
111 ; CHECK-NEXT: set_local 0, pop{{$}}
112 ; CHECK-NEXT: return (get_local 0){{$}}
102113 define float @one_f32() {
103114 ret float 1.0
104115 }
105116
106117 ; CHECK-LABEL: two_f32:
107118 ; CHECK-NEXT: .result f32{{$}}
119 ; CHECK-NEXT: .local
108120 ; CHECK-NEXT: f32.const 0x1p1{{$}}
109 ; CHECK-NEXT: set_local @0, pop{{$}}
110 ; CHECK-NEXT: return @0{{$}}
121 ; CHECK-NEXT: set_local 0, pop{{$}}
122 ; CHECK-NEXT: return (get_local 0){{$}}
111123 define float @two_f32() {
112124 ret float 2.0
113125 }
114126
115127 ; CHECK-LABEL: nan_f32:
116128 ; CHECK-NEXT: .result f32{{$}}
129 ; CHECK-NEXT: .local
117130 ; CHECK-NEXT: f32.const nan
118 ; CHECK-NEXT: set_local @0, pop{{$}}
119 ; CHECK-NEXT: return @0{{$}}
131 ; CHECK-NEXT: set_local 0, pop{{$}}
132 ; CHECK-NEXT: return (get_local 0){{$}}
120133 define float @nan_f32() {
121134 ret float 0x7FF8000000000000
122135 }
123136
124137 ; CHECK-LABEL: negnan_f32:
125138 ; CHECK-NEXT: .result f32{{$}}
139 ; CHECK-NEXT: .local
126140 ; CHECK-NEXT: f32.const -nan
127 ; CHECK-NEXT: set_local @0, pop{{$}}
128 ; CHECK-NEXT: return @0{{$}}
141 ; CHECK-NEXT: set_local 0, pop{{$}}
142 ; CHECK-NEXT: return (get_local 0){{$}}
129143 define float @negnan_f32() {
130144 ret float 0xFFF8000000000000
131145 }
132146
133147 ; CHECK-LABEL: inf_f32:
134148 ; CHECK-NEXT: .result f32{{$}}
149 ; CHECK-NEXT: .local
135150 ; CHECK-NEXT: f32.const infinity
136 ; CHECK-NEXT: set_local @0, pop{{$}}
137 ; CHECK-NEXT: return @0{{$}}
151 ; CHECK-NEXT: set_local 0, pop{{$}}
152 ; CHECK-NEXT: return (get_local 0){{$}}
138153 define float @inf_f32() {
139154 ret float 0x7FF0000000000000
140155 }
141156
142157 ; CHECK-LABEL: neginf_f32:
143158 ; CHECK-NEXT: .result f32{{$}}
159 ; CHECK-NEXT: .local
144160 ; CHECK-NEXT: f32.const -infinity
145 ; CHECK-NEXT: set_local @0, pop{{$}}
146 ; CHECK-NEXT: return @0{{$}}
161 ; CHECK-NEXT: set_local 0, pop{{$}}
162 ; CHECK-NEXT: return (get_local 0){{$}}
147163 define float @neginf_f32() {
148164 ret float 0xFFF0000000000000
149165 }
150166
151167 ; CHECK-LABEL: negzero_f64:
152168 ; CHECK-NEXT: .result f64{{$}}
169 ; CHECK-NEXT: .local
153170 ; CHECK-NEXT: f64.const -0x0p0{{$}}
154 ; CHECK-NEXT: set_local @0, pop{{$}}
155 ; CHECK-NEXT: return @0{{$}}
171 ; CHECK-NEXT: set_local 0, pop{{$}}
172 ; CHECK-NEXT: return (get_local 0){{$}}
156173 define double @negzero_f64() {
157174 ret double -0.0
158175 }
159176
160177 ; CHECK-LABEL: zero_f64:
161178 ; CHECK-NEXT: .result f64{{$}}
179 ; CHECK-NEXT: .local
162180 ; CHECK-NEXT: f64.const 0x0p0{{$}}
163 ; CHECK-NEXT: set_local @0, pop{{$}}
164 ; CHECK-NEXT: return @0{{$}}
181 ; CHECK-NEXT: set_local 0, pop{{$}}
182 ; CHECK-NEXT: return (get_local 0){{$}}
165183 define double @zero_f64() {
166184 ret double 0.0
167185 }
168186
169187 ; CHECK-LABEL: one_f64:
170188 ; CHECK-NEXT: .result f64{{$}}
189 ; CHECK-NEXT: .local
171190 ; CHECK-NEXT: f64.const 0x1p0{{$}}
172 ; CHECK-NEXT: set_local @0, pop{{$}}
173 ; CHECK-NEXT: return @0{{$}}
191 ; CHECK-NEXT: set_local 0, pop{{$}}
192 ; CHECK-NEXT: return (get_local 0){{$}}
174193 define double @one_f64() {
175194 ret double 1.0
176195 }
177196
178197 ; CHECK-LABEL: two_f64:
179198 ; CHECK-NEXT: .result f64{{$}}
199 ; CHECK-NEXT: .local
180200 ; CHECK-NEXT: f64.const 0x1p1{{$}}
181 ; CHECK-NEXT: set_local @0, pop{{$}}
182 ; CHECK-NEXT: return @0{{$}}
201 ; CHECK-NEXT: set_local 0, pop{{$}}
202 ; CHECK-NEXT: return (get_local 0){{$}}
183203 define double @two_f64() {
184204 ret double 2.0
185205 }
186206
187207 ; CHECK-LABEL: nan_f64:
188208 ; CHECK-NEXT: .result f64{{$}}
209 ; CHECK-NEXT: .local
189210 ; CHECK-NEXT: f64.const nan
190 ; CHECK-NEXT: set_local @0, pop{{$}}
191 ; CHECK-NEXT: return @0{{$}}
211 ; CHECK-NEXT: set_local 0, pop{{$}}
212 ; CHECK-NEXT: return (get_local 0){{$}}
192213 define double @nan_f64() {
193214 ret double 0x7FF8000000000000
194215 }
195216
196217 ; CHECK-LABEL: negnan_f64:
197218 ; CHECK-NEXT: .result f64{{$}}
219 ; CHECK-NEXT: .local
198220 ; CHECK-NEXT: f64.const -nan
199 ; CHECK-NEXT: set_local @0, pop{{$}}
200 ; CHECK-NEXT: return @0{{$}}
221 ; CHECK-NEXT: set_local 0, pop{{$}}
222 ; CHECK-NEXT: return (get_local 0){{$}}
201223 define double @negnan_f64() {
202224 ret double 0xFFF8000000000000
203225 }
204226
205227 ; CHECK-LABEL: inf_f64:
206228 ; CHECK-NEXT: .result f64{{$}}
229 ; CHECK-NEXT: .local
207230 ; CHECK-NEXT: f64.const infinity
208 ; CHECK-NEXT: set_local @0, pop{{$}}
209 ; CHECK-NEXT: return @0{{$}}
231 ; CHECK-NEXT: set_local 0, pop{{$}}
232 ; CHECK-NEXT: return (get_local 0){{$}}
210233 define double @inf_f64() {
211234 ret double 0x7FF0000000000000
212235 }
213236
214237 ; CHECK-LABEL: neginf_f64:
215238 ; CHECK-NEXT: .result f64{{$}}
239 ; CHECK-NEXT: .local
216240 ; CHECK-NEXT: f64.const -infinity
217 ; CHECK-NEXT: set_local @0, pop{{$}}
218 ; CHECK-NEXT: return @0{{$}}
241 ; CHECK-NEXT: set_local 0, pop{{$}}
242 ; CHECK-NEXT: return (get_local 0){{$}}
219243 define double @neginf_f64() {
220244 ret double 0xFFF0000000000000
221245 }
55 target triple = "wasm32-unknown-unknown"
66
77 ; CHECK-LABEL: sext_i8_i32:
8 ; CHECK: load_s_i8_i32 @1{{$}}
9 ; CHECK-NEXT: set_local @2, pop{{$}}
8 ; CHECK: load_s_i8_i32 (get_local 1){{$}}
9 ; CHECK-NEXT: set_local 2, pop{{$}}
1010 define i32 @sext_i8_i32(i8 *%p) {
1111 %v = load i8, i8* %p
1212 %e = sext i8 %v to i32
1414 }
1515
1616 ; CHECK-LABEL: zext_i8_i32:
17 ; CHECK: load_u_i8_i32 @1{{$}}
18 ; CHECK-NEXT: set_local @2, pop{{$}}
17 ; CHECK: load_u_i8_i32 (get_local 1){{$}}
18 ; CHECK-NEXT: set_local 2, pop{{$}}
1919 define i32 @zext_i8_i32(i8 *%p) {
2020 %v = load i8, i8* %p
2121 %e = zext i8 %v to i32
2323 }
2424
2525 ; CHECK-LABEL: sext_i16_i32:
26 ; CHECK: load_s_i16_i32 @1{{$}}
27 ; CHECK-NEXT: set_local @2, pop{{$}}
26 ; CHECK: load_s_i16_i32 (get_local 1){{$}}
27 ; CHECK-NEXT: set_local 2, pop{{$}}
2828 define i32 @sext_i16_i32(i16 *%p) {
2929 %v = load i16, i16* %p
3030 %e = sext i16 %v to i32
3232 }
3333
3434 ; CHECK-LABEL: zext_i16_i32:
35 ; CHECK: load_u_i16_i32 @1{{$}}
36 ; CHECK-NEXT: set_local @2, pop{{$}}
35 ; CHECK: load_u_i16_i32 (get_local 1){{$}}
36 ; CHECK-NEXT: set_local 2, pop{{$}}
3737 define i32 @zext_i16_i32(i16 *%p) {
3838 %v = load i16, i16* %p
3939 %e = zext i16 %v to i32
4141 }
4242
4343 ; CHECK-LABEL: sext_i8_i64:
44 ; CHECK: load_s_i8_i64 @1{{$}}
45 ; CHECK-NEXT: set_local @2, pop{{$}}
44 ; CHECK: load_s_i8_i64 (get_local 1){{$}}
45 ; CHECK-NEXT: set_local 2, pop{{$}}
4646 define i64 @sext_i8_i64(i8 *%p) {
4747 %v = load i8, i8* %p
4848 %e = sext i8 %v to i64
5050 }
5151
5252 ; CHECK-LABEL: zext_i8_i64:
53 ; CHECK: load_u_i8_i64 @1{{$}}
54 ; CHECK-NEXT: set_local @2, pop{{$}}
53 ; CHECK: load_u_i8_i64 (get_local 1){{$}}
54 ; CHECK-NEXT: set_local 2, pop{{$}}
5555 define i64 @zext_i8_i64(i8 *%p) {
5656 %v = load i8, i8* %p
5757 %e = zext i8 %v to i64
5959 }
6060
6161 ; CHECK-LABEL: sext_i16_i64:
62 ; CHECK: load_s_i16_i64 @1{{$}}
63 ; CHECK-NEXT: set_local @2, pop{{$}}
62 ; CHECK: load_s_i16_i64 (get_local 1){{$}}
63 ; CHECK-NEXT: set_local 2, pop{{$}}
6464 define i64 @sext_i16_i64(i16 *%p) {
6565 %v = load i16, i16* %p
6666 %e = sext i16 %v to i64
6868 }
6969
7070 ; CHECK-LABEL: zext_i16_i64:
71 ; CHECK: load_u_i16_i64 @1{{$}}
72 ; CHECK-NEXT: set_local @2, pop{{$}}
71 ; CHECK: load_u_i16_i64 (get_local 1){{$}}
72 ; CHECK-NEXT: set_local 2, pop{{$}}
7373 define i64 @zext_i16_i64(i16 *%p) {
7474 %v = load i16, i16* %p
7575 %e = zext i16 %v to i64
7777 }
7878
7979 ; CHECK-LABEL: sext_i32_i64:
80 ; CHECK: load_s_i32_i64 @1{{$}}
81 ; CHECK-NEXT: set_local @2, pop{{$}}
80 ; CHECK: load_s_i32_i64 (get_local 1){{$}}
81 ; CHECK-NEXT: set_local 2, pop{{$}}
8282 define i64 @sext_i32_i64(i32 *%p) {
8383 %v = load i32, i32* %p
8484 %e = sext i32 %v to i64
8686 }
8787
8888 ; CHECK-LABEL: zext_i32_i64:
89 ; CHECK: load_u_i32_i64 @1{{$}}
90 ; CHECK: set_local @2, pop{{$}}
89 ; CHECK: load_u_i32_i64 (get_local 1){{$}}
90 ; CHECK: set_local 2, pop{{$}}
9191 define i64 @zext_i32_i64(i32 *%p) {
9292 %v = load i32, i32* %p
9393 %e = zext i32 %v to i64
55 target triple = "wasm32-unknown-unknown"
66
77 ; CHECK-LABEL: load_u_i1_i32:
8 ; CHECK: load_u_i8_i32 @1{{$}}
9 ; CHECK-NEXT: set_local @2, pop{{$}}
10 ; CHECK-NEXT: return @2{{$}}
8 ; CHECK: load_u_i8_i32 (get_local 1){{$}}
9 ; CHECK-NEXT: set_local 2, pop{{$}}
10 ; CHECK-NEXT: return (get_local 2){{$}}
1111 define i32 @load_u_i1_i32(i1* %p) {
1212 %v = load i1, i1* %p
1313 %e = zext i1 %v to i32
1515 }
1616
1717 ; CHECK-LABEL: load_s_i1_i32:
18 ; CHECK: load_u_i8_i32 @1{{$}}
19 ; CHECK-NEXT: set_local @2, pop{{$}}
18 ; CHECK: load_u_i8_i32 (get_local 1){{$}}
19 ; CHECK-NEXT: set_local 2, pop{{$}}
2020 ; CHECK-NEXT: i32.const 31{{$}}
21 ; CHECK-NEXT: set_local @3, pop{{$}}
22 ; CHECK-NEXT: shl @2, @3{{$}}
23 ; CHECK-NEXT: set_local @4, pop{{$}}
24 ; CHECK-NEXT: shr_s @4, @3{{$}}
25 ; CHECK-NEXT: set_local @5, pop{{$}}
26 ; CHECK-NEXT: return @5{{$}}
21 ; CHECK-NEXT: set_local 3, pop{{$}}
22 ; CHECK-NEXT: shl (get_local 2), (get_local 3){{$}}
23 ; CHECK-NEXT: set_local 4, pop{{$}}
24 ; CHECK-NEXT: shr_s (get_local 4), (get_local 3){{$}}
25 ; CHECK-NEXT: set_local 5, pop{{$}}
26 ; CHECK-NEXT: return (get_local 5){{$}}
2727 define i32 @load_s_i1_i32(i1* %p) {
2828 %v = load i1, i1* %p
2929 %e = sext i1 %v to i32
3131 }
3232
3333 ; CHECK-LABEL: load_u_i1_i64:
34 ; CHECK: load_u_i8_i64 @1{{$}}
35 ; CHECK-NEXT: set_local @2, pop{{$}}
36 ; CHECK-NEXT: return @2{{$}}
34 ; CHECK: load_u_i8_i64 (get_local 1){{$}}
35 ; CHECK-NEXT: set_local 2, pop{{$}}
36 ; CHECK-NEXT: return (get_local 2){{$}}
3737 define i64 @load_u_i1_i64(i1* %p) {
3838 %v = load i1, i1* %p
3939 %e = zext i1 %v to i64
4141 }
4242
4343 ; CHECK-LABEL: load_s_i1_i64:
44 ; CHECK: load_u_i8_i64 @1{{$}}
45 ; CHECK-NEXT: set_local @2, pop{{$}}
44 ; CHECK: load_u_i8_i64 (get_local 1){{$}}
45 ; CHECK-NEXT: set_local 2, pop{{$}}
4646 ; CHECK-NEXT: i64.const 63{{$}}
47 ; CHECK-NEXT: set_local @3, pop{{$}}
48 ; CHECK-NEXT: shl @2, @3{{$}}
49 ; CHECK-NEXT: set_local @4, pop{{$}}
50 ; CHECK-NEXT: shr_s @4, @3{{$}}
51 ; CHECK-NEXT: set_local @5, pop{{$}}
52 ; CHECK-NEXT: return @5{{$}}
47 ; CHECK-NEXT: set_local 3, pop{{$}}
48 ; CHECK-NEXT: shl (get_local 2), (get_local 3){{$}}
49 ; CHECK-NEXT: set_local 4, pop{{$}}
50 ; CHECK-NEXT: shr_s (get_local 4), (get_local 3){{$}}
51 ; CHECK-NEXT: set_local 5, pop{{$}}
52 ; CHECK-NEXT: return (get_local 5){{$}}
5353 define i64 @load_s_i1_i64(i1* %p) {
5454 %v = load i1, i1* %p
5555 %e = sext i1 %v to i64
5858
5959 ; CHECK-LABEL: store_i32_i1:
6060 ; CHECK: i32.const 1{{$}}
61 ; CHECK-NEXT: set_local @4, pop{{$}}
62 ; CHECK-NEXT: and @3, @4{{$}}
63 ; CHECK-NEXT: set_local @5, pop{{$}}
64 ; CHECK-NEXT: store_i8 @2, @5{{$}}
61 ; CHECK-NEXT: set_local 4, pop{{$}}
62 ; CHECK-NEXT: and (get_local 3), (get_local 4){{$}}
63 ; CHECK-NEXT: set_local 5, pop{{$}}
64 ; CHECK-NEXT: store_i8 (get_local 2), (get_local 5){{$}}
6565 define void @store_i32_i1(i1* %p, i32 %v) {
6666 %t = trunc i32 %v to i1
6767 store i1 %t, i1* %p
7070
7171 ; CHECK-LABEL: store_i64_i1:
7272 ; CHECK: i64.const 1{{$}}
73 ; CHECK-NEXT: set_local @4, pop{{$}}
74 ; CHECK-NEXT: and @3, @4{{$}}
75 ; CHECK-NEXT: set_local @5, pop{{$}}
76 ; CHECK-NEXT: store_i8 @2, @5{{$}}
73 ; CHECK-NEXT: set_local 4, pop{{$}}
74 ; CHECK-NEXT: and (get_local 3), (get_local 4){{$}}
75 ; CHECK-NEXT: set_local 5, pop{{$}}
76 ; CHECK-NEXT: store_i8 (get_local 2), (get_local 5){{$}}
7777 define void @store_i64_i1(i1* %p, i64 %v) {
7878 %t = trunc i64 %v to i1
7979 store i1 %t, i1* %p
77 ; CHECK-LABEL: ldi32:
88 ; CHECK-NEXT: .param i32{{$}}
99 ; CHECK-NEXT: .result i32{{$}}
10 ; CHECK-NEXT: @0{{$}}
11 ; CHECK-NEXT: set_local @1, pop{{$}}
12 ; CHECK-NEXT: load_i32 @1{{$}}
13 ; CHECK-NEXT: set_local @2, pop{{$}}
14 ; CHECK-NEXT: return @2{{$}}
10 ; CHECK-NEXT: .local i32, i32{{$}}
11 ; CHECK-NEXT: get_local 0{{$}}
12 ; CHECK-NEXT: set_local 1, pop{{$}}
13 ; CHECK-NEXT: load_i32 (get_local 1){{$}}
14 ; CHECK-NEXT: set_local 2, pop{{$}}
15 ; CHECK-NEXT: return (get_local 2){{$}}
1516 define i32 @ldi32(i32 *%p) {
1617 %v = load i32, i32* %p
1718 ret i32 %v
2021 ; CHECK-LABEL: ldi64:
2122 ; CHECK-NEXT: .param i32{{$}}
2223 ; CHECK-NEXT: .result i64{{$}}
23 ; CHECK-NEXT: @0{{$}}
24 ; CHECK-NEXT: set_local @1, pop{{$}}
25 ; CHECK-NEXT: load_i64 @1{{$}}
26 ; CHECK-NEXT: set_local @2, pop{{$}}
27 ; CHECK-NEXT: return @2{{$}}
24 ; CHECK-NEXT: .local i32, i64{{$}}
25 ; CHECK-NEXT: get_local 0{{$}}
26 ; CHECK-NEXT: set_local 1, pop{{$}}
27 ; CHECK-NEXT: load_i64 (get_local 1){{$}}
28 ; CHECK-NEXT: set_local 2, pop{{$}}
29 ; CHECK-NEXT: return (get_local 2){{$}}
2830 define i64 @ldi64(i64 *%p) {
2931 %v = load i64, i64* %p
3032 ret i64 %v
3335 ; CHECK-LABEL: ldf32:
3436 ; CHECK-NEXT: .param i32{{$}}
3537 ; CHECK-NEXT: .result f32{{$}}
36 ; CHECK-NEXT: @0{{$}}
37 ; CHECK-NEXT: set_local @1, pop{{$}}
38 ; CHECK-NEXT: load_f32 @1{{$}}
39 ; CHECK-NEXT: set_local @2, pop{{$}}
40 ; CHECK-NEXT: return @2{{$}}
38 ; CHECK-NEXT: .local i32, f32{{$}}
39 ; CHECK-NEXT: get_local 0{{$}}
40 ; CHECK-NEXT: set_local 1, pop{{$}}
41 ; CHECK-NEXT: load_f32 (get_local 1){{$}}
42 ; CHECK-NEXT: set_local 2, pop{{$}}
43 ; CHECK-NEXT: return (get_local 2){{$}}
4144 define float @ldf32(float *%p) {
4245 %v = load float, float* %p
4346 ret float %v
4649 ; CHECK-LABEL: ldf64:
4750 ; CHECK-NEXT: .param i32{{$}}
4851 ; CHECK-NEXT: .result f64{{$}}
49 ; CHECK-NEXT: @0{{$}}
50 ; CHECK-NEXT: set_local @1, pop{{$}}
51 ; CHECK-NEXT: load_f64 @1{{$}}
52 ; CHECK-NEXT: set_local @2, pop{{$}}
53 ; CHECK-NEXT: return @2{{$}}
52 ; CHECK-NEXT: .local i32, f64{{$}}
53 ; CHECK-NEXT: get_local 0{{$}}
54 ; CHECK-NEXT: set_local 1, pop{{$}}
55 ; CHECK-NEXT: load_f64 (get_local 1){{$}}
56 ; CHECK-NEXT: set_local 2, pop{{$}}
57 ; CHECK-NEXT: return (get_local 2){{$}}
5458 define double @ldf64(double *%p) {
5559 %v = load double, double* %p
5660 ret double %v
1010
1111 ; CHECK-LABEL: page_size:
1212 ; CHECK-NEXT: .result i32{{$}}
13 ; CHECK-NEXT: .local i32{{$}}
1314 ; CHECK-NEXT: page_size
14 ; CHECK-NEXT: set_local @0, pop{{$}}
15 ; CHECK-NEXT: return @0{{$}}
15 ; CHECK-NEXT: set_local 0, pop{{$}}
16 ; CHECK-NEXT: return (get_local 0){{$}}
1617 define i32 @page_size() {
1718 %a = call i32 @llvm.wasm.page.size.i32()
1819 ret i32 %a
2021
2122 ; CHECK-LABEL: memory_size:
2223 ; CHECK-NEXT: .result i32{{$}}
24 ; CHECK-NEXT: .local i32{{$}}
2325 ; CHECK-NEXT: memory_size
24 ; CHECK-NEXT: set_local @0, pop{{$}}
25 ; CHECK-NEXT: return @0{{$}}
26 ; CHECK-NEXT: set_local 0, pop{{$}}
27 ; CHECK-NEXT: return (get_local 0){{$}}
2628 define i32 @memory_size() {
2729 %a = call i32 @llvm.wasm.memory.size.i32()
2830 ret i32 %a
3032
3133 ; CHECK-LABEL: resize_memory:
3234 ; CHECK-NEXT: .param i32
33 ; CHECK: resize_memory @1
35 ; CHECK-NEXT: .local i32{{$}}
36 ; CHECK: resize_memory (get_local 1)
3437 ; CHECK-NEXT: return
3538 define void @resize_memory(i32 %n) {
3639 call void @llvm.wasm.resize.memory.i32(i32 %n)
1010
1111 ; CHECK-LABEL: page_size:
1212 ; CHECK-NEXT: .result i64{{$}}
13 ; CHECK-NEXT: .local i64{{$}}
1314 ; CHECK-NEXT: page_size
14 ; CHECK-NEXT: set_local @0, pop{{$}}
15 ; CHECK-NEXT: return @0{{$}}
15 ; CHECK-NEXT: set_local 0, pop{{$}}
16 ; CHECK-NEXT: return (get_local 0){{$}}
1617 define i64 @page_size() {
1718 %a = call i64 @llvm.wasm.page.size.i64()
1819 ret i64 %a
2021
2122 ; CHECK-LABEL: memory_size:
2223 ; CHECK-NEXT: .result i64{{$}}
24 ; CHECK-NEXT: .local i64{{$}}
2325 ; CHECK-NEXT: memory_size
24 ; CHECK-NEXT: set_local @0, pop{{$}}
25 ; CHECK-NEXT: return @0{{$}}
26 ; CHECK-NEXT: set_local 0, pop{{$}}
27 ; CHECK-NEXT: return (get_local 0){{$}}
2628 define i64 @memory_size() {
2729 %a = call i64 @llvm.wasm.memory.size.i64()
2830 ret i64 %a
3032
3133 ; CHECK-LABEL: resize_memory:
3234 ; CHECK-NEXT: .param i64
33 ; CHECK: resize_memory @1
35 ; CHECK-NEXT: .local i64{{$}}
36 ; CHECK: resize_memory (get_local 1)
3437 ; CHECK-NEXT: return
3538 define void @resize_memory(i64 %n) {
3639 call void @llvm.wasm.resize.memory.i64(i64 %n)
77 ; Basic phi triangle.
88
99 ; CHECK-LABEL: test0:
10 ; CHECK: @0{{$}}
11 ; CHECK: set_local [[REG:@.*]], pop
12 ; CHECK: sdiv [[REG]], {{.*}}
10 ; CHECK: get_local 0{{$}}
11 ; CHECK: set_local [[REG:.*]], pop
12 ; CHECK: sdiv (get_local [[REG]]), {{.*}}
1313 ; CHECK: set_local [[REG]], pop
14 ; CHECK: return [[REG]]
14 ; CHECK: return (get_local [[REG]])
1515 define i32 @test0(i32 %p) {
1616 entry:
1717 %t = icmp slt i32 %p, 0
2828
2929 ; CHECK-LABEL: test1:
3030 ; CHECK: BB1_1:
31 ; CHECK: [[REG1:@.*]]
32 ; CHECK: set_local [[REG0:@.*]], pop
33 ; CHECK: [[REG2:@.*]]
31 ; CHECK: get_local [[REG1:.*]]
32 ; CHECK: set_local [[REG0:.*]], pop
33 ; CHECK: get_local [[REG2:.*]]
3434 ; CHECK: set_local [[REG1]], pop
3535 ; CHECK: [[REG0]]
3636 ; CHECK: set_local [[REG2]], pop
55 target triple = "wasm32-unknown-unknown"
66
77 ; CHECK-LABEL: trunc_i8_i32:
8 ; CHECK: store_i8 @3, @2{{$}}
8 ; CHECK: store_i8 (get_local 3), (get_local 2){{$}}
99 define void @trunc_i8_i32(i8 *%p, i32 %v) {
1010 %t = trunc i32 %v to i8
1111 store i8 %t, i8* %p
1313 }
1414
1515 ; CHECK-LABEL: trunc_i16_i32:
16 ; CHECK: store_i16 @3, @2{{$}}
16 ; CHECK: store_i16 (get_local 3), (get_local 2){{$}}
1717 define void @trunc_i16_i32(i16 *%p, i32 %v) {
1818 %t = trunc i32 %v to i16
1919 store i16 %t, i16* %p
2121 }
2222
2323 ; CHECK-LABEL: trunc_i8_i64:
24 ; CHECK: store_i8 @3, @2{{$}}
24 ; CHECK: store_i8 (get_local 3), (get_local 2){{$}}
2525 define void @trunc_i8_i64(i8 *%p, i64 %v) {
2626 %t = trunc i64 %v to i8
2727 store i8 %t, i8* %p
2929 }
3030
3131 ; CHECK-LABEL: trunc_i16_i64:
32 ; CHECK: store_i16 @3, @2{{$}}
32 ; CHECK: store_i16 (get_local 3), (get_local 2){{$}}
3333 define void @trunc_i16_i64(i16 *%p, i64 %v) {
3434 %t = trunc i64 %v to i16
3535 store i16 %t, i16* %p
3737 }
3838
3939 ; CHECK-LABEL: trunc_i32_i64:
40 ; CHECK: store_i32 @3, @2{{$}}
40 ; CHECK: store_i32 (get_local 3), (get_local 2){{$}}
4141 define void @trunc_i32_i64(i32 *%p, i64 %v) {
4242 %t = trunc i64 %v to i32
4343 store i32 %t, i32* %p
77 ; CHECK-LABEL: sti32:
88 ; CHECK-NEXT: .param i32{{$}}
99 ; CHECK-NEXT: .param i32{{$}}
10 ; CHECK-NEXT: @1{{$}}
11 ; CHECK-NEXT: set_local @2, pop{{$}}
12 ; CHECK-NEXT: @0{{$}}
13 ; CHECK-NEXT: set_local @3, pop{{$}}
14 ; CHECK-NEXT: store_i32 @3, @2{{$}}
10 ; CHECK-NEXT: .local i32, i32{{$}}
11 ; CHECK-NEXT: get_local 1{{$}}
12 ; CHECK-NEXT: set_local 2, pop{{$}}
13 ; CHECK-NEXT: get_local 0{{$}}
14 ; CHECK-NEXT: set_local 3, pop{{$}}
15 ; CHECK-NEXT: store_i32 (get_local 3), (get_local 2){{$}}
1516 ; CHECK-NEXT: return{{$}}
1617 define void @sti32(i32 *%p, i32 %v) {
1718 store i32 %v, i32* %p
2122 ; CHECK-LABEL: sti64:
2223 ; CHECK-NEXT: .param i32{{$}}
2324 ; CHECK-NEXT: .param i64{{$}}
24 ; CHECK-NEXT: @1{{$}}
25 ; CHECK-NEXT: set_local @2, pop{{$}}
26 ; CHECK-NEXT: @0{{$}}
27 ; CHECK-NEXT: set_local @3, pop{{$}}
28 ; CHECK-NEXT: store_i64 @3, @2{{$}}
25 ; CHECK-NEXT: .local i64, i32{{$}}
26 ; CHECK-NEXT: get_local 1{{$}}
27 ; CHECK-NEXT: set_local 2, pop{{$}}
28 ; CHECK-NEXT: get_local 0{{$}}
29 ; CHECK-NEXT: set_local 3, pop{{$}}
30 ; CHECK-NEXT: store_i64 (get_local 3), (get_local 2){{$}}
2931 ; CHECK-NEXT: return{{$}}
3032 define void @sti64(i64 *%p, i64 %v) {
3133 store i64 %v, i64* %p
3537 ; CHECK-LABEL: stf32:
3638 ; CHECK-NEXT: .param i32{{$}}
3739 ; CHECK-NEXT: .param f32{{$}}
38 ; CHECK-NEXT: @1{{$}}
39 ; CHECK-NEXT: set_local @2, pop{{$}}
40 ; CHECK-NEXT: @0{{$}}
41 ; CHECK-NEXT: set_local @3, pop{{$}}
42 ; CHECK-NEXT: store_f32 @3, @2{{$}}
40 ; CHECK-NEXT: .local f32, i32{{$}}
41 ; CHECK-NEXT: get_local 1{{$}}
42 ; CHECK-NEXT: set_local 2, pop{{$}}
43 ; CHECK-NEXT: get_local 0{{$}}
44 ; CHECK-NEXT: set_local 3, pop{{$}}
45 ; CHECK-NEXT: store_f32 (get_local 3), (get_local 2){{$}}
4346 ; CHECK-NEXT: return{{$}}
4447 define void @stf32(float *%p, float %v) {
4548 store float %v, float* %p
4952 ; CHECK-LABEL: stf64:
5053 ; CHECK-NEXT: .param i32{{$}}
5154 ; CHECK-NEXT: .param f64{{$}}
52 ; CHECK-NEXT: @1{{$}}
53 ; CHECK-NEXT: set_local @2, pop{{$}}
54 ; CHECK-NEXT: @0{{$}}
55 ; CHECK-NEXT: set_local @3, pop{{$}}
56 ; CHECK-NEXT: store_f64 @3, @2{{$}}
55 ; CHECK-NEXT: .local f64, i32{{$}}
56 ; CHECK-NEXT: get_local 1{{$}}
57 ; CHECK-NEXT: set_local 2, pop{{$}}
58 ; CHECK-NEXT: get_local 0{{$}}
59 ; CHECK-NEXT: set_local 3, pop{{$}}
60 ; CHECK-NEXT: store_f64 (get_local 3), (get_local 2){{$}}
5761 ; CHECK-NEXT: return{{$}}
5862 define void @stf64(double *%p, double %v) {
5963 store double %v, double* %p
88 ; CHECK-NEXT: .param i32{{$}}
99 ; CHECK-NEXT: .param i32{{$}}
1010 ; CHECK-NEXT: .result i32{{$}}
11 ; CHECK-NEXT: @1{{$}}
12 ; CHECK-NEXT: set_local @2, pop{{$}}
13 ; CHECK-NEXT: return @2{{$}}
11 ; CHECK-NEXT: .local i32{{$}}
12 ; CHECK-NEXT: get_local 1{{$}}
13 ; CHECK-NEXT: set_local 2, pop{{$}}
14 ; CHECK-NEXT: return (get_local 2){{$}}
1415 define i32 @unused_first(i32 %x, i32 %y) {
1516 ret i32 %y
1617 }
1920 ; CHECK-NEXT: .param i32{{$}}
2021 ; CHECK-NEXT: .param i32{{$}}
2122 ; CHECK-NEXT: .result i32{{$}}
22 ; CHECK-NEXT: @0{{$}}
23 ; CHECK-NEXT: set_local @2, pop{{$}}
24 ; CHECK-NEXT: return @2{{$}}
23 ; CHECK-NEXT: .local i32{{$}}
24 ; CHECK-NEXT: get_local 0{{$}}
25 ; CHECK-NEXT: set_local 2, pop{{$}}
26 ; CHECK-NEXT: return (get_local 2){{$}}
2527 define i32 @unused_second(i32 %x, i32 %y) {
2628 ret i32 %x
2729 }