Split testb3 into multiple files
[WebKit-https.git] / Source / JavaScriptCore / b3 / testb3_1.cpp
1 /*
2  * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24  */
25
26 #include "config.h"
27 #include "testb3.h"
28
29 #if ENABLE(B3_JIT)
30
31 Lock crashLock;
32
33 // Make sure the compiler does not try to optimize anything out.
34 static NEVER_INLINE double zero()
35 {
36     return 0.;
37 }
38
39 static double negativeZero()
40 {
41     return -zero();
42 }
43
44 bool shouldRun(const char* filter, const char* testName)
45 {
46     // FIXME: These tests fail <https://bugs.webkit.org/show_bug.cgi?id=199330>.
47     if (!filter && isARM64()) {
48         for (auto& failingTest : {
49             "testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead",
50             "testNegFloatWithUselessDoubleConversion",
51             "testPinRegisters",
52         }) {
53             if (WTF::findIgnoringASCIICaseWithoutLength(testName, failingTest) != WTF::notFound) {
54                 dataLogLn("*** Warning: Skipping known-bad test: ", testName);
55                 return false;
56             }
57         }
58     }
59     if (!filter && isX86()) {
60         for (auto& failingTest : {
61             "testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead",
62         }) {
63             if (WTF::findIgnoringASCIICaseWithoutLength(testName, failingTest) != WTF::notFound) {
64                 dataLogLn("*** Warning: Skipping known-bad test: ", testName);
65                 return false;
66             }
67         }
68     }
69     return !filter || WTF::findIgnoringASCIICaseWithoutLength(testName, filter) != WTF::notFound;
70 }
71
72 template<typename T>
73 void testRotR(T valueInt, int32_t shift)
74 {
75     Procedure proc;
76     BasicBlock* root = proc.addBlock();
77     
78     Value* value = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
79     if (sizeof(T) == 4)
80         value = root->appendNew<Value>(proc, Trunc, Origin(), value);
81     
82     Value* ammount = root->appendNew<Value>(proc, Trunc, Origin(),
83         root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
84     root->appendNewControlValue(proc, Return, Origin(),
85         root->appendNew<Value>(proc, RotR, Origin(), value, ammount));
86     
87     CHECK_EQ(compileAndRun<T>(proc, valueInt, shift), rotateRight(valueInt, shift));
88 }
89
90 template<typename T>
91 void testRotL(T valueInt, int32_t shift)
92 {
93     Procedure proc;
94     BasicBlock* root = proc.addBlock();
95     
96     Value* value = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
97     if (sizeof(T) == 4)
98         value = root->appendNew<Value>(proc, Trunc, Origin(), value);
99     
100     Value* ammount = root->appendNew<Value>(proc, Trunc, Origin(),
101         root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
102     root->appendNewControlValue(proc, Return, Origin(),
103         root->appendNew<Value>(proc, RotL, Origin(), value, ammount));
104     
105     CHECK_EQ(compileAndRun<T>(proc, valueInt, shift), rotateLeft(valueInt, shift));
106 }
107
108
109 template<typename T>
110 void testRotRWithImmShift(T valueInt, int32_t shift)
111 {
112     Procedure proc;
113     BasicBlock* root = proc.addBlock();
114     
115     Value* value = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
116     if (sizeof(T) == 4)
117         value = root->appendNew<Value>(proc, Trunc, Origin(), value);
118     
119     Value* ammount = root->appendIntConstant(proc, Origin(), Int32, shift);
120     root->appendNewControlValue(proc, Return, Origin(),
121         root->appendNew<Value>(proc, RotR, Origin(), value, ammount));
122     
123     CHECK_EQ(compileAndRun<T>(proc, valueInt, shift), rotateRight(valueInt, shift));
124 }
125
126 template<typename T>
127 void testRotLWithImmShift(T valueInt, int32_t shift)
128 {
129     Procedure proc;
130     BasicBlock* root = proc.addBlock();
131     
132     Value* value = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
133     if (sizeof(T) == 4)
134         value = root->appendNew<Value>(proc, Trunc, Origin(), value);
135     
136     Value* ammount = root->appendIntConstant(proc, Origin(), Int32, shift);
137     root->appendNewControlValue(proc, Return, Origin(),
138         root->appendNew<Value>(proc, RotL, Origin(), value, ammount));
139     
140     CHECK_EQ(compileAndRun<T>(proc, valueInt, shift), rotateLeft(valueInt, shift));
141 }
142
143 template<typename T>
144 void testComputeDivisionMagic(T value, T magicMultiplier, unsigned shift)
145 {
146     DivisionMagic<T> magic = computeDivisionMagic(value);
147     CHECK(magic.magicMultiplier == magicMultiplier);
148     CHECK(magic.shift == shift);
149 }
150
151 void run(const char* filter)
152 {
153     Deque<RefPtr<SharedTask<void()>>> tasks;
154
155     RUN_NOW(testTerminalPatchpointThatNeedsToBeSpilled2());
156     RUN(test42());
157     RUN(testLoad42());
158     RUN(testLoadAcq42());
159     RUN(testLoadOffsetImm9Max());
160     RUN(testLoadOffsetImm9MaxPlusOne());
161     RUN(testLoadOffsetImm9MaxPlusTwo());
162     RUN(testLoadOffsetImm9Min());
163     RUN(testLoadOffsetImm9MinMinusOne());
164     RUN(testLoadOffsetScaledUnsignedImm12Max());
165     RUN(testLoadOffsetScaledUnsignedOverImm12Max());
166     RUN(testArg(43));
167     RUN(testReturnConst64(5));
168     RUN(testReturnConst64(-42));
169     RUN(testReturnVoid());
170
171     RUN_BINARY(testBitXorTreeArgs, int64Operands(), int64Operands());
172     RUN_BINARY(testBitXorTreeArgsEven, int64Operands(), int64Operands());
173     RUN_BINARY(testBitXorTreeArgImm, int64Operands(), int64Operands());
174     RUN_UNARY(testAddTreeArg32, int32Operands());
175     RUN_UNARY(testMulTreeArg32, int32Operands());
176     RUN_UNARY(testBitAndTreeArg32, int32Operands());
177     RUN_UNARY(testBitOrTreeArg32, int32Operands());
178
179     RUN(testAddArg(111));
180     RUN(testAddArgs(1, 1));
181     RUN(testAddArgs(1, 2));
182     RUN(testAddArgImm(1, 2));
183     RUN(testAddArgImm(0, 2));
184     RUN(testAddArgImm(1, 0));
185     RUN(testAddImmArg(1, 2));
186     RUN(testAddImmArg(0, 2));
187     RUN(testAddImmArg(1, 0));
188     RUN_BINARY(testAddArgMem, int64Operands(), int64Operands());
189     RUN_BINARY(testAddMemArg, int64Operands(), int64Operands());
190     RUN_BINARY(testAddImmMem, int64Operands(), int64Operands());
191     RUN_UNARY(testAddArg32, int32Operands());
192     RUN(testAddArgs32(1, 1));
193     RUN(testAddArgs32(1, 2));
194     RUN_BINARY(testAddArgMem32, int32Operands(), int32Operands());
195     RUN_BINARY(testAddMemArg32, int32Operands(), int32Operands());
196     RUN_BINARY(testAddImmMem32, int32Operands(), int32Operands());
197     RUN_BINARY(testAddNeg1, int32Operands(), int32Operands());
198     RUN_BINARY(testAddNeg2, int32Operands(), int32Operands());
199     RUN(testAddArgZeroImmZDef());
200     RUN(testAddLoadTwice());
201     RUN_TERNARY(testAddMulMulArgs, int64Operands(), int64Operands(), int64Operands());
202
203     RUN(testAddArgDouble(M_PI));
204     RUN(testAddArgsDouble(M_PI, 1));
205     RUN(testAddArgsDouble(M_PI, -M_PI));
206     RUN(testAddArgImmDouble(M_PI, 1));
207     RUN(testAddArgImmDouble(M_PI, 0));
208     RUN(testAddArgImmDouble(M_PI, negativeZero()));
209     RUN(testAddArgImmDouble(0, 0));
210     RUN(testAddArgImmDouble(0, negativeZero()));
211     RUN(testAddArgImmDouble(negativeZero(), 0));
212     RUN(testAddArgImmDouble(negativeZero(), negativeZero()));
213     RUN(testAddImmArgDouble(M_PI, 1));
214     RUN(testAddImmArgDouble(M_PI, 0));
215     RUN(testAddImmArgDouble(M_PI, negativeZero()));
216     RUN(testAddImmArgDouble(0, 0));
217     RUN(testAddImmArgDouble(0, negativeZero()));
218     RUN(testAddImmArgDouble(negativeZero(), 0));
219     RUN(testAddImmArgDouble(negativeZero(), negativeZero()));
220     RUN(testAddImmsDouble(M_PI, 1));
221     RUN(testAddImmsDouble(M_PI, 0));
222     RUN(testAddImmsDouble(M_PI, negativeZero()));
223     RUN(testAddImmsDouble(0, 0));
224     RUN(testAddImmsDouble(0, negativeZero()));
225     RUN(testAddImmsDouble(negativeZero(), negativeZero()));
226     RUN_UNARY(testAddArgFloat, floatingPointOperands<float>());
227     RUN_BINARY(testAddArgsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
228     RUN_BINARY(testAddFPRArgsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
229     RUN_BINARY(testAddArgImmFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
230     RUN_BINARY(testAddImmArgFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
231     RUN_BINARY(testAddImmsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
232     RUN_UNARY(testAddArgFloatWithUselessDoubleConversion, floatingPointOperands<float>());
233     RUN_BINARY(testAddArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
234     RUN_BINARY(testAddArgsFloatWithEffectfulDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
235
236     RUN(testMulArg(5));
237     RUN(testMulAddArg(5));
238     RUN(testMulAddArg(85));
239     RUN(testMulArgStore(5));
240     RUN(testMulArgStore(85));
241     RUN(testMulArgs(1, 1));
242     RUN(testMulArgs(1, 2));
243     RUN(testMulArgs(3, 3));
244     RUN(testMulArgImm(1, 2));
245     RUN(testMulArgImm(1, 4));
246     RUN(testMulArgImm(1, 8));
247     RUN(testMulArgImm(1, 16));
248     RUN(testMulArgImm(1, 0x80000000llu));
249     RUN(testMulArgImm(1, 0x800000000000llu));
250     RUN(testMulArgImm(7, 2));
251     RUN(testMulArgImm(7, 4));
252     RUN(testMulArgImm(7, 8));
253     RUN(testMulArgImm(7, 16));
254     RUN(testMulArgImm(7, 0x80000000llu));
255     RUN(testMulArgImm(7, 0x800000000000llu));
256     RUN(testMulArgImm(-42, 2));
257     RUN(testMulArgImm(-42, 4));
258     RUN(testMulArgImm(-42, 8));
259     RUN(testMulArgImm(-42, 16));
260     RUN(testMulArgImm(-42, 0x80000000llu));
261     RUN(testMulArgImm(-42, 0x800000000000llu));
262     RUN(testMulArgImm(0, 2));
263     RUN(testMulArgImm(1, 0));
264     RUN(testMulArgImm(3, 3));
265     RUN(testMulArgImm(3, -1));
266     RUN(testMulArgImm(-3, -1));
267     RUN(testMulArgImm(0, -1));
268     RUN(testMulImmArg(1, 2));
269     RUN(testMulImmArg(0, 2));
270     RUN(testMulImmArg(1, 0));
271     RUN(testMulImmArg(3, 3));
272     RUN(testMulImm32SignExtend(1, 2));
273     RUN(testMulImm32SignExtend(0, 2));
274     RUN(testMulImm32SignExtend(1, 0));
275     RUN(testMulImm32SignExtend(3, 3));
276     RUN(testMulImm32SignExtend(0xFFFFFFFF, 0xFFFFFFFF));
277     RUN(testMulImm32SignExtend(0xFFFFFFFE, 0xFFFFFFFF));
278     RUN(testMulImm32SignExtend(0xFFFFFFFF, 0xFFFFFFFE));
279     RUN(testMulArgs32(1, 1));
280     RUN(testMulArgs32(1, 2));
281     RUN(testMulArgs32(0xFFFFFFFF, 0xFFFFFFFF));
282     RUN(testMulArgs32(0xFFFFFFFE, 0xFFFFFFFF));
283     RUN(testMulArgs32SignExtend(1, 1));
284     RUN(testMulArgs32SignExtend(1, 2));
285     RUN(testMulArgs32SignExtend(0xFFFFFFFF, 0xFFFFFFFF));
286     RUN(testMulArgs32SignExtend(0xFFFFFFFE, 0xFFFFFFFF));
287     RUN(testMulLoadTwice());
288     RUN(testMulAddArgsLeft());
289     RUN(testMulAddArgsRight());
290     RUN(testMulAddArgsLeft32());
291     RUN(testMulAddArgsRight32());
292     RUN(testMulSubArgsLeft());
293     RUN(testMulSubArgsRight());
294     RUN(testMulSubArgsLeft32());
295     RUN(testMulSubArgsRight32());
296     RUN(testMulNegArgs());
297     RUN(testMulNegArgs32());
298
299     RUN_BINARY(testMulArgNegArg, int64Operands(), int64Operands())
300     RUN_BINARY(testMulNegArgArg, int64Operands(), int64Operands())
301     RUN_UNARY(testMulArgDouble, floatingPointOperands<double>());
302     RUN_BINARY(testMulArgsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
303     RUN_BINARY(testMulArgImmDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
304     RUN_BINARY(testMulImmArgDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
305     RUN_BINARY(testMulImmsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
306     RUN_UNARY(testMulArgFloat, floatingPointOperands<float>());
307     RUN_BINARY(testMulArgsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
308     RUN_BINARY(testMulArgImmFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
309     RUN_BINARY(testMulImmArgFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
310     RUN_BINARY(testMulImmsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
311     RUN_UNARY(testMulArgFloatWithUselessDoubleConversion, floatingPointOperands<float>());
312     RUN_BINARY(testMulArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
313     RUN_BINARY(testMulArgsFloatWithEffectfulDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
314
315     RUN(testDivArgDouble(M_PI));
316     RUN(testDivArgsDouble(M_PI, 1));
317     RUN(testDivArgsDouble(M_PI, -M_PI));
318     RUN(testDivArgImmDouble(M_PI, 1));
319     RUN(testDivArgImmDouble(M_PI, 0));
320     RUN(testDivArgImmDouble(M_PI, negativeZero()));
321     RUN(testDivArgImmDouble(0, 0));
322     RUN(testDivArgImmDouble(0, negativeZero()));
323     RUN(testDivArgImmDouble(negativeZero(), 0));
324     RUN(testDivArgImmDouble(negativeZero(), negativeZero()));
325     RUN(testDivImmArgDouble(M_PI, 1));
326     RUN(testDivImmArgDouble(M_PI, 0));
327     RUN(testDivImmArgDouble(M_PI, negativeZero()));
328     RUN(testDivImmArgDouble(0, 0));
329     RUN(testDivImmArgDouble(0, negativeZero()));
330     RUN(testDivImmArgDouble(negativeZero(), 0));
331     RUN(testDivImmArgDouble(negativeZero(), negativeZero()));
332     RUN(testDivImmsDouble(M_PI, 1));
333     RUN(testDivImmsDouble(M_PI, 0));
334     RUN(testDivImmsDouble(M_PI, negativeZero()));
335     RUN(testDivImmsDouble(0, 0));
336     RUN(testDivImmsDouble(0, negativeZero()));
337     RUN(testDivImmsDouble(negativeZero(), negativeZero()));
338     RUN_UNARY(testDivArgFloat, floatingPointOperands<float>());
339     RUN_BINARY(testDivArgsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
340     RUN_BINARY(testDivArgImmFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
341     RUN_BINARY(testDivImmArgFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
342     RUN_BINARY(testDivImmsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
343     RUN_UNARY(testDivArgFloatWithUselessDoubleConversion, floatingPointOperands<float>());
344     RUN_BINARY(testDivArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
345     RUN_BINARY(testDivArgsFloatWithEffectfulDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
346
347     RUN_BINARY(testUDivArgsInt32, int32Operands(), int32Operands());
348     RUN_BINARY(testUDivArgsInt64, int64Operands(), int64Operands());
349
350     RUN_UNARY(testModArgDouble, floatingPointOperands<double>());
351     RUN_BINARY(testModArgsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
352     RUN_BINARY(testModArgImmDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
353     RUN_BINARY(testModImmArgDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
354     RUN_BINARY(testModImmsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
355     RUN_UNARY(testModArgFloat, floatingPointOperands<float>());
356     RUN_BINARY(testModArgsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
357     RUN_BINARY(testModArgImmFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
358     RUN_BINARY(testModImmArgFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
359     RUN_BINARY(testModImmsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
360
361     RUN_BINARY(testUModArgsInt32, int32Operands(), int32Operands());
362     RUN_BINARY(testUModArgsInt64, int64Operands(), int64Operands());
363
364     RUN(testSubArg(24));
365     RUN(testSubArgs(1, 1));
366     RUN(testSubArgs(1, 2));
367     RUN(testSubArgs(13, -42));
368     RUN(testSubArgs(-13, 42));
369     RUN(testSubArgImm(1, 1));
370     RUN(testSubArgImm(1, 2));
371     RUN(testSubArgImm(13, -42));
372     RUN(testSubArgImm(-13, 42));
373     RUN(testSubArgImm(42, 0));
374     RUN(testSubImmArg(1, 1));
375     RUN(testSubImmArg(1, 2));
376     RUN(testSubImmArg(13, -42));
377     RUN(testSubImmArg(-13, 42));
378     RUN_BINARY(testSubArgMem, int64Operands(), int64Operands());
379     RUN_BINARY(testSubMemArg, int64Operands(), int64Operands());
380     RUN_BINARY(testSubImmMem, int32Operands(), int32Operands());
381     RUN_BINARY(testSubMemImm, int32Operands(), int32Operands());
382     RUN_BINARY(testSubNeg, int32Operands(), int32Operands());
383     RUN_BINARY(testNegSub, int32Operands(), int32Operands());
384     RUN_UNARY(testNegValueSubOne, int32Operands());
385     RUN_BINARY(testNegMulArgImm, int64Operands(), int64Operands());
386     RUN_TERNARY(testSubMulMulArgs, int64Operands(), int64Operands(), int64Operands());
387
388     RUN_TERNARY(testSubSub, int32Operands(), int32Operands(), int32Operands());
389     RUN_TERNARY(testSubSub2, int32Operands(), int32Operands(), int32Operands());
390     RUN_TERNARY(testSubAdd, int32Operands(), int32Operands(), int32Operands());
391     RUN_BINARY(testSubFirstNeg, int32Operands(), int32Operands());
392
393     RUN(testSubArgs32(1, 1));
394     RUN(testSubArgs32(1, 2));
395     RUN(testSubArgs32(13, -42));
396     RUN(testSubArgs32(-13, 42));
397     RUN(testSubArgImm32(1, 1));
398     RUN(testSubArgImm32(1, 2));
399     RUN(testSubArgImm32(13, -42));
400     RUN(testSubArgImm32(-13, 42));
401     RUN(testSubImmArg32(1, 1));
402     RUN(testSubImmArg32(1, 2));
403     RUN(testSubImmArg32(13, -42));
404     RUN(testSubImmArg32(-13, 42));
405     RUN_BINARY(testSubArgMem32, int32Operands(), int32Operands());
406     RUN_BINARY(testSubMemArg32, int32Operands(), int32Operands());
407     RUN_BINARY(testSubImmMem32, int32Operands(), int32Operands());
408     RUN_BINARY(testSubMemImm32, int32Operands(), int32Operands());
409     RUN_UNARY(testNegValueSubOne32, int64Operands());
410
411     RUN_UNARY(testSubArgDouble, floatingPointOperands<double>());
412     RUN_BINARY(testSubArgsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
413     RUN_BINARY(testSubArgImmDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
414     RUN_BINARY(testSubImmArgDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
415     RUN_BINARY(testSubImmsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
416     RUN_UNARY(testSubArgFloat, floatingPointOperands<float>());
417     RUN_BINARY(testSubArgsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
418     RUN_BINARY(testSubArgImmFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
419     RUN_BINARY(testSubImmArgFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
420     RUN_BINARY(testSubImmsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
421     RUN_UNARY(testSubArgFloatWithUselessDoubleConversion, floatingPointOperands<float>());
422     RUN_BINARY(testSubArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
423     RUN_BINARY(testSubArgsFloatWithEffectfulDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
424
425     RUN_UNARY(testNegDouble, floatingPointOperands<double>());
426     RUN_UNARY(testNegFloat, floatingPointOperands<float>());
427     RUN_UNARY(testNegFloatWithUselessDoubleConversion, floatingPointOperands<float>());
428
429     RUN(testBitAndArgs(43, 43));
430     RUN(testBitAndArgs(43, 0));
431     RUN(testBitAndArgs(10, 3));
432     RUN(testBitAndArgs(42, 0xffffffffffffffff));
433     RUN(testBitAndSameArg(43));
434     RUN(testBitAndSameArg(0));
435     RUN(testBitAndSameArg(3));
436     RUN(testBitAndSameArg(0xffffffffffffffff));
437     RUN(testBitAndImms(43, 43));
438     RUN(testBitAndImms(43, 0));
439     RUN(testBitAndImms(10, 3));
440     RUN(testBitAndImms(42, 0xffffffffffffffff));
441     RUN(testBitAndArgImm(43, 43));
442     RUN(testBitAndArgImm(43, 0));
443     RUN(testBitAndArgImm(10, 3));
444     RUN(testBitAndArgImm(42, 0xffffffffffffffff));
445     RUN(testBitAndArgImm(42, 0xff));
446     RUN(testBitAndArgImm(300, 0xff));
447     RUN(testBitAndArgImm(-300, 0xff));
448     RUN(testBitAndArgImm(42, 0xffff));
449     RUN(testBitAndArgImm(40000, 0xffff));
450     RUN(testBitAndArgImm(-40000, 0xffff));
451     RUN(testBitAndImmArg(43, 43));
452     RUN(testBitAndImmArg(43, 0));
453     RUN(testBitAndImmArg(10, 3));
454     RUN(testBitAndImmArg(42, 0xffffffffffffffff));
455     RUN(testBitAndBitAndArgImmImm(2, 7, 3));
456     RUN(testBitAndBitAndArgImmImm(1, 6, 6));
457     RUN(testBitAndBitAndArgImmImm(0xffff, 24, 7));
458     RUN(testBitAndImmBitAndArgImm(7, 2, 3));
459     RUN(testBitAndImmBitAndArgImm(6, 1, 6));
460     RUN(testBitAndImmBitAndArgImm(24, 0xffff, 7));
461     RUN(testBitAndArgs32(43, 43));
462     RUN(testBitAndArgs32(43, 0));
463     RUN(testBitAndArgs32(10, 3));
464     RUN(testBitAndArgs32(42, 0xffffffff));
465     RUN(testBitAndSameArg32(43));
466     RUN(testBitAndSameArg32(0));
467     RUN(testBitAndSameArg32(3));
468     RUN(testBitAndSameArg32(0xffffffff));
469     RUN(testBitAndImms32(43, 43));
470     RUN(testBitAndImms32(43, 0));
471     RUN(testBitAndImms32(10, 3));
472     RUN(testBitAndImms32(42, 0xffffffff));
473     RUN(testBitAndArgImm32(43, 43));
474     RUN(testBitAndArgImm32(43, 0));
475     RUN(testBitAndArgImm32(10, 3));
476     RUN(testBitAndArgImm32(42, 0xffffffff));
477     RUN(testBitAndImmArg32(43, 43));
478     RUN(testBitAndImmArg32(43, 0));
479     RUN(testBitAndImmArg32(10, 3));
480     RUN(testBitAndImmArg32(42, 0xffffffff));
481     RUN(testBitAndImmArg32(42, 0xff));
482     RUN(testBitAndImmArg32(300, 0xff));
483     RUN(testBitAndImmArg32(-300, 0xff));
484     RUN(testBitAndImmArg32(42, 0xffff));
485     RUN(testBitAndImmArg32(40000, 0xffff));
486     RUN(testBitAndImmArg32(-40000, 0xffff));
487     RUN(testBitAndBitAndArgImmImm32(2, 7, 3));
488     RUN(testBitAndBitAndArgImmImm32(1, 6, 6));
489     RUN(testBitAndBitAndArgImmImm32(0xffff, 24, 7));
490     RUN(testBitAndImmBitAndArgImm32(7, 2, 3));
491     RUN(testBitAndImmBitAndArgImm32(6, 1, 6));
492     RUN(testBitAndImmBitAndArgImm32(24, 0xffff, 7));
493     RUN_BINARY(testBitAndWithMaskReturnsBooleans, int64Operands(), int64Operands());
494     RUN_UNARY(testBitAndArgDouble, floatingPointOperands<double>());
495     RUN_BINARY(testBitAndArgsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
496     RUN_BINARY(testBitAndArgImmDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
497     RUN_BINARY(testBitAndImmsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
498     RUN_UNARY(testBitAndArgFloat, floatingPointOperands<float>());
499     RUN_BINARY(testBitAndArgsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
500     RUN_BINARY(testBitAndArgImmFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
501     RUN_BINARY(testBitAndImmsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
502     RUN_BINARY(testBitAndArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
503     RUN_BINARY(testBitAndNotNot, int64Operands(), int64Operands());
504     RUN_BINARY(testBitAndNotImm, int64Operands(), int64Operands());
505
506     RUN(testBitOrArgs(43, 43));
507     RUN(testBitOrArgs(43, 0));
508     RUN(testBitOrArgs(10, 3));
509     RUN(testBitOrArgs(42, 0xffffffffffffffff));
510     RUN(testBitOrSameArg(43));
511     RUN(testBitOrSameArg(0));
512     RUN(testBitOrSameArg(3));
513     RUN(testBitOrSameArg(0xffffffffffffffff));
514     RUN(testBitOrImms(43, 43));
515     RUN(testBitOrImms(43, 0));
516     RUN(testBitOrImms(10, 3));
517     RUN(testBitOrImms(42, 0xffffffffffffffff));
518     RUN(testBitOrArgImm(43, 43));
519     RUN(testBitOrArgImm(43, 0));
520     RUN(testBitOrArgImm(10, 3));
521     RUN(testBitOrArgImm(42, 0xffffffffffffffff));
522     RUN(testBitOrImmArg(43, 43));
523     RUN(testBitOrImmArg(43, 0));
524     RUN(testBitOrImmArg(10, 3));
525     RUN(testBitOrImmArg(42, 0xffffffffffffffff));
526     RUN(testBitOrBitOrArgImmImm(2, 7, 3));
527     RUN(testBitOrBitOrArgImmImm(1, 6, 6));
528     RUN(testBitOrBitOrArgImmImm(0xffff, 24, 7));
529     RUN(testBitOrImmBitOrArgImm(7, 2, 3));
530     RUN(testBitOrImmBitOrArgImm(6, 1, 6));
531     RUN(testBitOrImmBitOrArgImm(24, 0xffff, 7));
532     RUN(testBitOrArgs32(43, 43));
533     RUN(testBitOrArgs32(43, 0));
534     RUN(testBitOrArgs32(10, 3));
535     RUN(testBitOrArgs32(42, 0xffffffff));
536     RUN(testBitOrSameArg32(43));
537     RUN(testBitOrSameArg32(0));
538     RUN(testBitOrSameArg32(3));
539     RUN(testBitOrSameArg32(0xffffffff));
540     RUN(testBitOrImms32(43, 43));
541     RUN(testBitOrImms32(43, 0));
542     RUN(testBitOrImms32(10, 3));
543     RUN(testBitOrImms32(42, 0xffffffff));
544     RUN(testBitOrArgImm32(43, 43));
545     RUN(testBitOrArgImm32(43, 0));
546     RUN(testBitOrArgImm32(10, 3));
547     RUN(testBitOrArgImm32(42, 0xffffffff));
548     RUN(testBitOrImmArg32(43, 43));
549     RUN(testBitOrImmArg32(43, 0));
550     RUN(testBitOrImmArg32(10, 3));
551     RUN(testBitOrImmArg32(42, 0xffffffff));
552     RUN(testBitOrBitOrArgImmImm32(2, 7, 3));
553     RUN(testBitOrBitOrArgImmImm32(1, 6, 6));
554     RUN(testBitOrBitOrArgImmImm32(0xffff, 24, 7));
555     RUN(testBitOrImmBitOrArgImm32(7, 2, 3));
556     RUN(testBitOrImmBitOrArgImm32(6, 1, 6));
557     RUN(testBitOrImmBitOrArgImm32(24, 0xffff, 7));
558     RUN_UNARY(testBitOrArgDouble, floatingPointOperands<double>());
559     RUN_BINARY(testBitOrArgsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
560     RUN_BINARY(testBitOrArgImmDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
561     RUN_BINARY(testBitOrImmsDouble, floatingPointOperands<double>(), floatingPointOperands<double>());
562     RUN_UNARY(testBitOrArgFloat, floatingPointOperands<float>());
563     RUN_BINARY(testBitOrArgsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
564     RUN_BINARY(testBitOrArgImmFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
565     RUN_BINARY(testBitOrImmsFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
566     RUN_BINARY(testBitOrArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
567     RUN_TERNARY(testBitOrAndAndArgs, int64Operands(), int64Operands(), int64Operands());
568     RUN_BINARY(testBitOrAndSameArgs, int64Operands(), int64Operands());
569     RUN_BINARY(testBitOrNotNot, int64Operands(), int64Operands());
570     RUN_BINARY(testBitOrNotImm, int64Operands(), int64Operands());
571
572     RUN_BINARY(testBitXorArgs, int64Operands(), int64Operands());
573     RUN_UNARY(testBitXorSameArg, int64Operands());
574     RUN_BINARY(testBitXorImms, int64Operands(), int64Operands());
575     RUN_BINARY(testBitXorArgImm, int64Operands(), int64Operands());
576     RUN_BINARY(testBitXorImmArg, int64Operands(), int64Operands());
577     RUN(testBitXorBitXorArgImmImm(2, 7, 3));
578     RUN(testBitXorBitXorArgImmImm(1, 6, 6));
579     RUN(testBitXorBitXorArgImmImm(0xffff, 24, 7));
580     RUN(testBitXorImmBitXorArgImm(7, 2, 3));
581     RUN(testBitXorImmBitXorArgImm(6, 1, 6));
582     RUN(testBitXorImmBitXorArgImm(24, 0xffff, 7));
583     RUN(testBitXorArgs32(43, 43));
584     RUN(testBitXorArgs32(43, 0));
585     RUN(testBitXorArgs32(10, 3));
586     RUN(testBitXorArgs32(42, 0xffffffff));
587     RUN(testBitXorSameArg32(43));
588     RUN(testBitXorSameArg32(0));
589     RUN(testBitXorSameArg32(3));
590     RUN(testBitXorSameArg32(0xffffffff));
591     RUN(testBitXorImms32(43, 43));
592     RUN(testBitXorImms32(43, 0));
593     RUN(testBitXorImms32(10, 3));
594     RUN(testBitXorImms32(42, 0xffffffff));
595     RUN(testBitXorArgImm32(43, 43));
596     RUN(testBitXorArgImm32(43, 0));
597     RUN(testBitXorArgImm32(10, 3));
598     RUN(testBitXorArgImm32(42, 0xffffffff));
599     RUN(testBitXorImmArg32(43, 43));
600     RUN(testBitXorImmArg32(43, 0));
601     RUN(testBitXorImmArg32(10, 3));
602     RUN(testBitXorImmArg32(42, 0xffffffff));
603     RUN(testBitXorBitXorArgImmImm32(2, 7, 3));
604     RUN(testBitXorBitXorArgImmImm32(1, 6, 6));
605     RUN(testBitXorBitXorArgImmImm32(0xffff, 24, 7));
606     RUN(testBitXorImmBitXorArgImm32(7, 2, 3));
607     RUN(testBitXorImmBitXorArgImm32(6, 1, 6));
608     RUN(testBitXorImmBitXorArgImm32(24, 0xffff, 7));
609     RUN_TERNARY(testBitXorAndAndArgs, int64Operands(), int64Operands(), int64Operands());
610     RUN_BINARY(testBitXorAndSameArgs, int64Operands(), int64Operands());
611
612     RUN_UNARY(testBitNotArg, int64Operands());
613     RUN_UNARY(testBitNotImm, int64Operands());
614     RUN_UNARY(testBitNotMem, int64Operands());
615     RUN_UNARY(testBitNotArg32, int32Operands());
616     RUN_UNARY(testBitNotImm32, int32Operands());
617     RUN_UNARY(testBitNotMem32, int32Operands());
618     RUN_BINARY(testNotOnBooleanAndBranch32, int32Operands(), int32Operands());
619     RUN_BINARY(testBitNotOnBooleanAndBranch32, int32Operands(), int32Operands());
620
621     RUN(testShlArgs(1, 0));
622     RUN(testShlArgs(1, 1));
623     RUN(testShlArgs(1, 62));
624     RUN(testShlArgs(0xffffffffffffffff, 0));
625     RUN(testShlArgs(0xffffffffffffffff, 1));
626     RUN(testShlArgs(0xffffffffffffffff, 63));
627     RUN(testShlImms(1, 0));
628     RUN(testShlImms(1, 1));
629     RUN(testShlImms(1, 62));
630     RUN(testShlImms(1, 65));
631     RUN(testShlImms(0xffffffffffffffff, 0));
632     RUN(testShlImms(0xffffffffffffffff, 1));
633     RUN(testShlImms(0xffffffffffffffff, 63));
634     RUN(testShlArgImm(1, 0));
635     RUN(testShlArgImm(1, 1));
636     RUN(testShlArgImm(1, 62));
637     RUN(testShlArgImm(1, 65));
638     RUN(testShlArgImm(0xffffffffffffffff, 0));
639     RUN(testShlArgImm(0xffffffffffffffff, 1));
640     RUN(testShlArgImm(0xffffffffffffffff, 63));
641     RUN(testShlSShrArgImm(1, 0));
642     RUN(testShlSShrArgImm(1, 1));
643     RUN(testShlSShrArgImm(1, 62));
644     RUN(testShlSShrArgImm(1, 65));
645     RUN(testShlSShrArgImm(0xffffffffffffffff, 0));
646     RUN(testShlSShrArgImm(0xffffffffffffffff, 1));
647     RUN(testShlSShrArgImm(0xffffffffffffffff, 63));
648     RUN(testShlArg32(2));
649     RUN(testShlArgs32(1, 0));
650     RUN(testShlArgs32(1, 1));
651     RUN(testShlArgs32(1, 62));
652     RUN(testShlImms32(1, 33));
653     RUN(testShlArgs32(0xffffffff, 0));
654     RUN(testShlArgs32(0xffffffff, 1));
655     RUN(testShlArgs32(0xffffffff, 63));
656     RUN(testShlImms32(1, 0));
657     RUN(testShlImms32(1, 1));
658     RUN(testShlImms32(1, 62));
659     RUN(testShlImms32(1, 33));
660     RUN(testShlImms32(0xffffffff, 0));
661     RUN(testShlImms32(0xffffffff, 1));
662     RUN(testShlImms32(0xffffffff, 63));
663     RUN(testShlArgImm32(1, 0));
664     RUN(testShlArgImm32(1, 1));
665     RUN(testShlArgImm32(1, 62));
666     RUN(testShlArgImm32(1, 33));
667     RUN(testShlArgImm32(0xffffffff, 0));
668     RUN(testShlArgImm32(0xffffffff, 1));
669     RUN(testShlArgImm32(0xffffffff, 63));
670     RUN(testShlZShrArgImm32(1, 0));
671     RUN(testShlZShrArgImm32(1, 1));
672     RUN(testShlZShrArgImm32(1, 62));
673     RUN(testShlZShrArgImm32(1, 33));
674     RUN(testShlZShrArgImm32(0xffffffff, 0));
675     RUN(testShlZShrArgImm32(0xffffffff, 1));
676     RUN(testShlZShrArgImm32(0xffffffff, 63));
677
678     RUN(testSShrArgs(1, 0));
679     RUN(testSShrArgs(1, 1));
680     RUN(testSShrArgs(1, 62));
681     RUN(testSShrArgs(0xffffffffffffffff, 0));
682     RUN(testSShrArgs(0xffffffffffffffff, 1));
683     RUN(testSShrArgs(0xffffffffffffffff, 63));
684     RUN(testSShrImms(1, 0));
685     RUN(testSShrImms(1, 1));
686     RUN(testSShrImms(1, 62));
687     RUN(testSShrImms(1, 65));
688     RUN(testSShrImms(0xffffffffffffffff, 0));
689     RUN(testSShrImms(0xffffffffffffffff, 1));
690     RUN(testSShrImms(0xffffffffffffffff, 63));
691     RUN(testSShrArgImm(1, 0));
692     RUN(testSShrArgImm(1, 1));
693     RUN(testSShrArgImm(1, 62));
694     RUN(testSShrArgImm(1, 65));
695     RUN(testSShrArgImm(0xffffffffffffffff, 0));
696     RUN(testSShrArgImm(0xffffffffffffffff, 1));
697     RUN(testSShrArgImm(0xffffffffffffffff, 63));
698     RUN(testSShrArg32(32));
699     RUN(testSShrArgs32(1, 0));
700     RUN(testSShrArgs32(1, 1));
701     RUN(testSShrArgs32(1, 62));
702     RUN(testSShrArgs32(1, 33));
703     RUN(testSShrArgs32(0xffffffff, 0));
704     RUN(testSShrArgs32(0xffffffff, 1));
705     RUN(testSShrArgs32(0xffffffff, 63));
706     RUN(testSShrImms32(1, 0));
707     RUN(testSShrImms32(1, 1));
708     RUN(testSShrImms32(1, 62));
709     RUN(testSShrImms32(1, 33));
710     RUN(testSShrImms32(0xffffffff, 0));
711     RUN(testSShrImms32(0xffffffff, 1));
712     RUN(testSShrImms32(0xffffffff, 63));
713     RUN(testSShrArgImm32(1, 0));
714     RUN(testSShrArgImm32(1, 1));
715     RUN(testSShrArgImm32(1, 62));
716     RUN(testSShrArgImm32(0xffffffff, 0));
717     RUN(testSShrArgImm32(0xffffffff, 1));
718     RUN(testSShrArgImm32(0xffffffff, 63));
719
720     RUN(testZShrArgs(1, 0));
721     RUN(testZShrArgs(1, 1));
722     RUN(testZShrArgs(1, 62));
723     RUN(testZShrArgs(0xffffffffffffffff, 0));
724     RUN(testZShrArgs(0xffffffffffffffff, 1));
725     RUN(testZShrArgs(0xffffffffffffffff, 63));
726     RUN(testZShrImms(1, 0));
727     RUN(testZShrImms(1, 1));
728     RUN(testZShrImms(1, 62));
729     RUN(testZShrImms(1, 65));
730     RUN(testZShrImms(0xffffffffffffffff, 0));
731     RUN(testZShrImms(0xffffffffffffffff, 1));
732     RUN(testZShrImms(0xffffffffffffffff, 63));
733     RUN(testZShrArgImm(1, 0));
734     RUN(testZShrArgImm(1, 1));
735     RUN(testZShrArgImm(1, 62));
736     RUN(testZShrArgImm(1, 65));
737     RUN(testZShrArgImm(0xffffffffffffffff, 0));
738     RUN(testZShrArgImm(0xffffffffffffffff, 1));
739     RUN(testZShrArgImm(0xffffffffffffffff, 63));
740     RUN(testZShrArg32(32));
741     RUN(testZShrArgs32(1, 0));
742     RUN(testZShrArgs32(1, 1));
743     RUN(testZShrArgs32(1, 62));
744     RUN(testZShrArgs32(1, 33));
745     RUN(testZShrArgs32(0xffffffff, 0));
746     RUN(testZShrArgs32(0xffffffff, 1));
747     RUN(testZShrArgs32(0xffffffff, 63));
748     RUN(testZShrImms32(1, 0));
749     RUN(testZShrImms32(1, 1));
750     RUN(testZShrImms32(1, 62));
751     RUN(testZShrImms32(1, 33));
752     RUN(testZShrImms32(0xffffffff, 0));
753     RUN(testZShrImms32(0xffffffff, 1));
754     RUN(testZShrImms32(0xffffffff, 63));
755     RUN(testZShrArgImm32(1, 0));
756     RUN(testZShrArgImm32(1, 1));
757     RUN(testZShrArgImm32(1, 62));
758     RUN(testZShrArgImm32(0xffffffff, 0));
759     RUN(testZShrArgImm32(0xffffffff, 1));
760     RUN(testZShrArgImm32(0xffffffff, 63));
761
762     RUN_UNARY(testClzArg64, int64Operands());
763     RUN_UNARY(testClzMem64, int64Operands());
764     RUN_UNARY(testClzArg32, int32Operands());
765     RUN_UNARY(testClzMem32, int64Operands());
766
767     RUN_UNARY(testAbsArg, floatingPointOperands<double>());
768     RUN_UNARY(testAbsImm, floatingPointOperands<double>());
769     RUN_UNARY(testAbsMem, floatingPointOperands<double>());
770     RUN_UNARY(testAbsAbsArg, floatingPointOperands<double>());
771     RUN_UNARY(testAbsNegArg, floatingPointOperands<double>());
772     RUN_UNARY(testAbsBitwiseCastArg, floatingPointOperands<double>());
773     RUN_UNARY(testBitwiseCastAbsBitwiseCastArg, floatingPointOperands<double>());
774     RUN_UNARY(testAbsArg, floatingPointOperands<float>());
775     RUN_UNARY(testAbsImm, floatingPointOperands<float>());
776     RUN_UNARY(testAbsMem, floatingPointOperands<float>());
777     RUN_UNARY(testAbsAbsArg, floatingPointOperands<float>());
778     RUN_UNARY(testAbsNegArg, floatingPointOperands<float>());
779     RUN_UNARY(testAbsBitwiseCastArg, floatingPointOperands<float>());
780     RUN_UNARY(testBitwiseCastAbsBitwiseCastArg, floatingPointOperands<float>());
781     RUN_UNARY(testAbsArgWithUselessDoubleConversion, floatingPointOperands<float>());
782     RUN_UNARY(testAbsArgWithEffectfulDoubleConversion, floatingPointOperands<float>());
783
784     RUN_UNARY(testCeilArg, floatingPointOperands<double>());
785     RUN_UNARY(testCeilImm, floatingPointOperands<double>());
786     RUN_UNARY(testCeilMem, floatingPointOperands<double>());
787     RUN_UNARY(testCeilCeilArg, floatingPointOperands<double>());
788     RUN_UNARY(testFloorCeilArg, floatingPointOperands<double>());
789     RUN_UNARY(testCeilIToD64, int64Operands());
790     RUN_UNARY(testCeilIToD32, int32Operands());
791     RUN_UNARY(testCeilArg, floatingPointOperands<float>());
792     RUN_UNARY(testCeilImm, floatingPointOperands<float>());
793     RUN_UNARY(testCeilMem, floatingPointOperands<float>());
794     RUN_UNARY(testCeilCeilArg, floatingPointOperands<float>());
795     RUN_UNARY(testFloorCeilArg, floatingPointOperands<float>());
796     RUN_UNARY(testCeilArgWithUselessDoubleConversion, floatingPointOperands<float>());
797     RUN_UNARY(testCeilArgWithEffectfulDoubleConversion, floatingPointOperands<float>());
798
799     RUN_UNARY(testFloorArg, floatingPointOperands<double>());
800     RUN_UNARY(testFloorImm, floatingPointOperands<double>());
801     RUN_UNARY(testFloorMem, floatingPointOperands<double>());
802     RUN_UNARY(testFloorFloorArg, floatingPointOperands<double>());
803     RUN_UNARY(testCeilFloorArg, floatingPointOperands<double>());
804     RUN_UNARY(testFloorIToD64, int64Operands());
805     RUN_UNARY(testFloorIToD32, int32Operands());
806     RUN_UNARY(testFloorArg, floatingPointOperands<float>());
807     RUN_UNARY(testFloorImm, floatingPointOperands<float>());
808     RUN_UNARY(testFloorMem, floatingPointOperands<float>());
809     RUN_UNARY(testFloorFloorArg, floatingPointOperands<float>());
810     RUN_UNARY(testCeilFloorArg, floatingPointOperands<float>());
811     RUN_UNARY(testFloorArgWithUselessDoubleConversion, floatingPointOperands<float>());
812     RUN_UNARY(testFloorArgWithEffectfulDoubleConversion, floatingPointOperands<float>());
813
814     RUN_UNARY(testSqrtArg, floatingPointOperands<double>());
815     RUN_UNARY(testSqrtImm, floatingPointOperands<double>());
816     RUN_UNARY(testSqrtMem, floatingPointOperands<double>());
817     RUN_UNARY(testSqrtArg, floatingPointOperands<float>());
818     RUN_UNARY(testSqrtImm, floatingPointOperands<float>());
819     RUN_UNARY(testSqrtMem, floatingPointOperands<float>());
820     RUN_UNARY(testSqrtArgWithUselessDoubleConversion, floatingPointOperands<float>());
821     RUN_UNARY(testSqrtArgWithEffectfulDoubleConversion, floatingPointOperands<float>());
822
823     RUN_BINARY(testCompareTwoFloatToDouble, floatingPointOperands<float>(), floatingPointOperands<float>());
824     RUN_BINARY(testCompareOneFloatToDouble, floatingPointOperands<float>(), floatingPointOperands<double>());
825     RUN_BINARY(testCompareFloatToDoubleThroughPhi, floatingPointOperands<float>(), floatingPointOperands<float>());
826     RUN_UNARY(testDoubleToFloatThroughPhi, floatingPointOperands<float>());
827     RUN(testReduceFloatToDoubleValidates());
828     RUN_UNARY(testDoubleProducerPhiToFloatConversion, floatingPointOperands<float>());
829     RUN_UNARY(testDoubleProducerPhiToFloatConversionWithDoubleConsumer, floatingPointOperands<float>());
830     RUN_BINARY(testDoubleProducerPhiWithNonFloatConst, floatingPointOperands<float>(), floatingPointOperands<double>());
831
832     RUN_UNARY(testDoubleArgToInt64BitwiseCast, floatingPointOperands<double>());
833     RUN_UNARY(testDoubleImmToInt64BitwiseCast, floatingPointOperands<double>());
834     RUN_UNARY(testTwoBitwiseCastOnDouble, floatingPointOperands<double>());
835     RUN_UNARY(testBitwiseCastOnDoubleInMemory, floatingPointOperands<double>());
836     RUN_UNARY(testBitwiseCastOnDoubleInMemoryIndexed, floatingPointOperands<double>());
837     RUN_UNARY(testInt64BArgToDoubleBitwiseCast, int64Operands());
838     RUN_UNARY(testInt64BImmToDoubleBitwiseCast, int64Operands());
839     RUN_UNARY(testTwoBitwiseCastOnInt64, int64Operands());
840     RUN_UNARY(testBitwiseCastOnInt64InMemory, int64Operands());
841     RUN_UNARY(testBitwiseCastOnInt64InMemoryIndexed, int64Operands());
842     RUN_UNARY(testFloatImmToInt32BitwiseCast, floatingPointOperands<float>());
843     RUN_UNARY(testBitwiseCastOnFloatInMemory, floatingPointOperands<float>());
844     RUN_UNARY(testInt32BArgToFloatBitwiseCast, int32Operands());
845     RUN_UNARY(testInt32BImmToFloatBitwiseCast, int32Operands());
846     RUN_UNARY(testTwoBitwiseCastOnInt32, int32Operands());
847     RUN_UNARY(testBitwiseCastOnInt32InMemory, int32Operands());
848
849     RUN_UNARY(testConvertDoubleToFloatArg, floatingPointOperands<double>());
850     RUN_UNARY(testConvertDoubleToFloatImm, floatingPointOperands<double>());
851     RUN_UNARY(testConvertDoubleToFloatMem, floatingPointOperands<double>());
852     RUN_UNARY(testConvertFloatToDoubleArg, floatingPointOperands<float>());
853     RUN_UNARY(testConvertFloatToDoubleImm, floatingPointOperands<float>());
854     RUN_UNARY(testConvertFloatToDoubleMem, floatingPointOperands<float>());
855     RUN_UNARY(testConvertDoubleToFloatToDoubleToFloat, floatingPointOperands<double>());
856     RUN_UNARY(testStoreFloat, floatingPointOperands<double>());
857     RUN_UNARY(testStoreDoubleConstantAsFloat, floatingPointOperands<double>());
858     RUN_UNARY(testLoadFloatConvertDoubleConvertFloatStoreFloat, floatingPointOperands<float>());
859     RUN_UNARY(testFroundArg, floatingPointOperands<double>());
860     RUN_UNARY(testFroundMem, floatingPointOperands<double>());
861
862     RUN(testIToD64Arg());
863     RUN(testIToF64Arg());
864     RUN(testIToD32Arg());
865     RUN(testIToF32Arg());
866     RUN(testIToD64Mem());
867     RUN(testIToF64Mem());
868     RUN(testIToD32Mem());
869     RUN(testIToF32Mem());
870     RUN_UNARY(testIToD64Imm, int64Operands());
871     RUN_UNARY(testIToF64Imm, int64Operands());
872     RUN_UNARY(testIToD32Imm, int32Operands());
873     RUN_UNARY(testIToF32Imm, int32Operands());
874     RUN(testIToDReducedToIToF64Arg());
875     RUN(testIToDReducedToIToF32Arg());
876
877     RUN(testStore32(44));
878     RUN(testStoreConstant(49));
879     RUN(testStoreConstantPtr(49));
880     RUN(testStore8Arg());
881     RUN(testStore8Imm());
882     RUN(testStorePartial8BitRegisterOnX86());
883     RUN(testStore16Arg());
884     RUN(testStore16Imm());
885     RUN(testTrunc((static_cast<int64_t>(1) << 40) + 42));
886     RUN(testAdd1(45));
887     RUN(testAdd1Ptr(51));
888     RUN(testAdd1Ptr(static_cast<intptr_t>(0xbaadbeef)));
889     RUN(testNeg32(52));
890     RUN(testNegPtr(53));
891     RUN(testStoreAddLoad32(46));
892     RUN(testStoreRelAddLoadAcq32(46));
893     RUN(testStoreAddLoadImm32(46));
894     RUN(testStoreAddLoad64(4600));
895     RUN(testStoreRelAddLoadAcq64(4600));
896     RUN(testStoreAddLoadImm64(4600));
897     RUN(testStoreAddLoad8(4, Load8Z));
898     RUN(testStoreRelAddLoadAcq8(4, Load8Z));
899     RUN(testStoreRelAddFenceLoadAcq8(4, Load8Z));
900     RUN(testStoreAddLoadImm8(4, Load8Z));
901     RUN(testStoreAddLoad8(4, Load8S));
902     RUN(testStoreRelAddLoadAcq8(4, Load8S));
903     RUN(testStoreAddLoadImm8(4, Load8S));
904     RUN(testStoreAddLoad16(6, Load16Z));
905     RUN(testStoreRelAddLoadAcq16(6, Load16Z));
906     RUN(testStoreAddLoadImm16(6, Load16Z));
907     RUN(testStoreAddLoad16(6, Load16S));
908     RUN(testStoreRelAddLoadAcq16(6, Load16S));
909     RUN(testStoreAddLoadImm16(6, Load16S));
910     RUN(testStoreAddLoad32Index(46));
911     RUN(testStoreAddLoadImm32Index(46));
912     RUN(testStoreAddLoad64Index(4600));
913     RUN(testStoreAddLoadImm64Index(4600));
914     RUN(testStoreAddLoad8Index(4, Load8Z));
915     RUN(testStoreAddLoadImm8Index(4, Load8Z));
916     RUN(testStoreAddLoad8Index(4, Load8S));
917     RUN(testStoreAddLoadImm8Index(4, Load8S));
918     RUN(testStoreAddLoad16Index(6, Load16Z));
919     RUN(testStoreAddLoadImm16Index(6, Load16Z));
920     RUN(testStoreAddLoad16Index(6, Load16S));
921     RUN(testStoreAddLoadImm16Index(6, Load16S));
922     RUN(testStoreSubLoad(46));
923     RUN(testStoreAddLoadInterference(52));
924     RUN(testStoreAddAndLoad(47, 0xffff));
925     RUN(testStoreAddAndLoad(470000, 0xffff));
926     RUN(testStoreNegLoad32(54));
927     RUN(testStoreNegLoadPtr(55));
928     RUN(testAdd1Uncommuted(48));
929     RUN(testLoadOffset());
930     RUN(testLoadOffsetNotConstant());
931     RUN(testLoadOffsetUsingAdd());
932     RUN(testLoadOffsetUsingAddInterference());
933     RUN(testLoadOffsetUsingAddNotConstant());
934     RUN(testLoadAddrShift(0));
935     RUN(testLoadAddrShift(1));
936     RUN(testLoadAddrShift(2));
937     RUN(testLoadAddrShift(3));
938     RUN(testFramePointer());
939     RUN(testOverrideFramePointer());
940     RUN(testStackSlot());
941     RUN(testLoadFromFramePointer());
942     RUN(testStoreLoadStackSlot(50));
943     
944     RUN(testBranch());
945     RUN(testBranchPtr());
946     RUN(testDiamond());
947     RUN(testBranchNotEqual());
948     RUN(testBranchNotEqualCommute());
949     RUN(testBranchNotEqualNotEqual());
950     RUN(testBranchEqual());
951     RUN(testBranchEqualEqual());
952     RUN(testBranchEqualCommute());
953     RUN(testBranchEqualEqual1());
954     RUN_BINARY(testBranchEqualOrUnorderedArgs, floatingPointOperands<double>(), floatingPointOperands<double>());
955     RUN_BINARY(testBranchEqualOrUnorderedArgs, floatingPointOperands<float>(), floatingPointOperands<float>());
956     RUN_BINARY(testBranchNotEqualAndOrderedArgs, floatingPointOperands<double>(), floatingPointOperands<double>());
957     RUN_BINARY(testBranchNotEqualAndOrderedArgs, floatingPointOperands<float>(), floatingPointOperands<float>());
958     RUN_BINARY(testBranchEqualOrUnorderedDoubleArgImm, floatingPointOperands<double>(), floatingPointOperands<double>());
959     RUN_BINARY(testBranchEqualOrUnorderedFloatArgImm, floatingPointOperands<float>(), floatingPointOperands<float>());
960     RUN_BINARY(testBranchEqualOrUnorderedDoubleImms, floatingPointOperands<double>(), floatingPointOperands<double>());
961     RUN_BINARY(testBranchEqualOrUnorderedFloatImms, floatingPointOperands<float>(), floatingPointOperands<float>());
962     RUN_BINARY(testBranchEqualOrUnorderedFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
963     RUN_BINARY(testBranchNotEqualAndOrderedArgs, floatingPointOperands<double>(), floatingPointOperands<double>());
964     RUN_BINARY(testBranchNotEqualAndOrderedArgs, floatingPointOperands<float>(), floatingPointOperands<float>());
965     RUN(testBranchFold(42));
966     RUN(testBranchFold(0));
967     RUN(testDiamondFold(42));
968     RUN(testDiamondFold(0));
969     RUN(testBranchNotEqualFoldPtr(42));
970     RUN(testBranchNotEqualFoldPtr(0));
971     RUN(testBranchEqualFoldPtr(42));
972     RUN(testBranchEqualFoldPtr(0));
973     RUN(testBranchLoadPtr());
974     RUN(testBranchLoad32());
975     RUN(testBranchLoad8S());
976     RUN(testBranchLoad8Z());
977     RUN(testBranchLoad16S());
978     RUN(testBranchLoad16Z());
979     RUN(testBranch8WithLoad8ZIndex());
980
981     RUN(testComplex(64, 128));
982     RUN(testComplex(4, 128));
983     RUN(testComplex(4, 256));
984     RUN(testComplex(4, 384));
985
986     RUN_BINARY(testBranchBitTest32TmpImm, int32Operands(), int32Operands());
987     RUN_BINARY(testBranchBitTest32AddrImm, int32Operands(), int32Operands());
988     RUN_BINARY(testBranchBitTest32TmpTmp, int32Operands(), int32Operands());
989     RUN_BINARY(testBranchBitTest64TmpTmp, int64Operands(), int64Operands());
990     RUN_BINARY(testBranchBitTest64AddrTmp, int64Operands(), int64Operands());
991     RUN_BINARY(testBranchBitTestNegation, int64Operands(), int64Operands());
992     RUN_BINARY(testBranchBitTestNegation2, int64Operands(), int64Operands());
993
994     RUN(testSimplePatchpoint());
995     RUN(testSimplePatchpointWithoutOuputClobbersGPArgs());
996     RUN(testSimplePatchpointWithOuputClobbersGPArgs());
997     RUN(testSimplePatchpointWithoutOuputClobbersFPArgs());
998     RUN(testSimplePatchpointWithOuputClobbersFPArgs());
999     RUN(testPatchpointWithEarlyClobber());
1000     RUN(testPatchpointCallArg());
1001     RUN(testPatchpointFixedRegister());
1002     RUN(testPatchpointAny(ValueRep::WarmAny));
1003     RUN(testPatchpointAny(ValueRep::ColdAny));
1004     RUN(testPatchpointGPScratch());
1005     RUN(testPatchpointFPScratch());
1006     RUN(testPatchpointLotsOfLateAnys());
1007     RUN(testPatchpointAnyImm(ValueRep::WarmAny));
1008     RUN(testPatchpointAnyImm(ValueRep::ColdAny));
1009     RUN(testPatchpointAnyImm(ValueRep::LateColdAny));
1010     RUN(testPatchpointManyImms());
1011     RUN(testPatchpointWithRegisterResult());
1012     RUN(testPatchpointWithStackArgumentResult());
1013     RUN(testPatchpointWithAnyResult());
1014     RUN(testSimpleCheck());
1015     RUN(testCheckFalse());
1016     RUN(testCheckTrue());
1017     RUN(testCheckLessThan());
1018     RUN(testCheckMegaCombo());
1019     RUN(testCheckTrickyMegaCombo());
1020     RUN(testCheckTwoMegaCombos());
1021     RUN(testCheckTwoNonRedundantMegaCombos());
1022     RUN(testCheckAddImm());
1023     RUN(testCheckAddImmCommute());
1024     RUN(testCheckAddImmSomeRegister());
1025     RUN(testCheckAdd());
1026     RUN(testCheckAdd64());
1027     RUN(testCheckAddFold(100, 200));
1028     RUN(testCheckAddFoldFail(2147483647, 100));
1029     RUN(testCheckAddArgumentAliasing64());
1030     RUN(testCheckAddArgumentAliasing32());
1031     RUN(testCheckAddSelfOverflow64());
1032     RUN(testCheckAddSelfOverflow32());
1033     RUN(testCheckSubImm());
1034     RUN(testCheckSubBadImm());
1035     RUN(testCheckSub());
1036     RUN(testCheckSub64());
1037     RUN(testCheckSubFold(100, 200));
1038     RUN(testCheckSubFoldFail(-2147483647, 100));
1039     RUN(testCheckNeg());
1040     RUN(testCheckNeg64());
1041     RUN(testCheckMul());
1042     RUN(testCheckMulMemory());
1043     RUN(testCheckMul2());
1044     RUN(testCheckMul64());
1045     RUN(testCheckMulFold(100, 200));
1046     RUN(testCheckMulFoldFail(2147483647, 100));
1047     RUN(testCheckMulArgumentAliasing64());
1048     RUN(testCheckMulArgumentAliasing32());
1049
1050     RUN_BINARY([](int32_t a, int32_t b) { testCompare(Equal, a, b); }, int64Operands(), int64Operands());
1051     RUN_BINARY([](int32_t a, int32_t b) { testCompare(NotEqual, a, b); }, int64Operands(), int64Operands());
1052     RUN_BINARY([](int32_t a, int32_t b) { testCompare(LessThan, a, b); }, int64Operands(), int64Operands());
1053     RUN_BINARY([](int32_t a, int32_t b) { testCompare(GreaterThan, a, b); }, int64Operands(), int64Operands());
1054     RUN_BINARY([](int32_t a, int32_t b) { testCompare(LessEqual, a, b); }, int64Operands(), int64Operands());
1055     RUN_BINARY([](int32_t a, int32_t b) { testCompare(GreaterEqual, a, b); }, int64Operands(), int64Operands());
1056     RUN_BINARY([](int32_t a, int32_t b) { testCompare(Below, a, b); }, int64Operands(), int64Operands());
1057     RUN_BINARY([](int32_t a, int32_t b) { testCompare(Above, a, b); }, int64Operands(), int64Operands());
1058     RUN_BINARY([](int32_t a, int32_t b) { testCompare(BelowEqual, a, b); }, int64Operands(), int64Operands());
1059     RUN_BINARY([](int32_t a, int32_t b) { testCompare(AboveEqual, a, b); }, int64Operands(), int64Operands());
1060     RUN_BINARY([](int32_t a, int32_t b) { testCompare(BitAnd, a, b); }, int64Operands(), int64Operands());
1061
1062     RUN(testEqualDouble(42, 42, true));
1063     RUN(testEqualDouble(0, -0, true));
1064     RUN(testEqualDouble(42, 43, false));
1065     RUN(testEqualDouble(PNaN, 42, false));
1066     RUN(testEqualDouble(42, PNaN, false));
1067     RUN(testEqualDouble(PNaN, PNaN, false));
1068
1069     addLoadTests(filter, tasks);
1070
1071     RUN(testSpillGP());
1072     RUN(testSpillFP());
1073
1074     RUN(testInt32ToDoublePartialRegisterStall());
1075     RUN(testInt32ToDoublePartialRegisterWithoutStall());
1076
1077     RUN(testCallSimple(1, 2));
1078     RUN(testCallRare(1, 2));
1079     RUN(testCallRareLive(1, 2, 3));
1080     RUN(testCallSimplePure(1, 2));
1081     RUN(testCallFunctionWithHellaArguments());
1082     RUN(testCallFunctionWithHellaArguments2());
1083     RUN(testCallFunctionWithHellaArguments3());
1084
1085     RUN(testReturnDouble(0.0));
1086     RUN(testReturnDouble(negativeZero()));
1087     RUN(testReturnDouble(42.5));
1088     RUN_UNARY(testReturnFloat, floatingPointOperands<float>());
1089
1090     RUN(testCallSimpleDouble(1, 2));
1091     RUN(testCallFunctionWithHellaDoubleArguments());
1092     RUN_BINARY(testCallSimpleFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
1093     RUN(testCallFunctionWithHellaFloatArguments());
1094
1095     RUN(testLinearScanWithCalleeOnStack());
1096
1097     RUN(testChillDiv(4, 2, 2));
1098     RUN(testChillDiv(1, 0, 0));
1099     RUN(testChillDiv(0, 0, 0));
1100     RUN(testChillDiv(1, -1, -1));
1101     RUN(testChillDiv(-2147483647 - 1, 0, 0));
1102     RUN(testChillDiv(-2147483647 - 1, 1, -2147483647 - 1));
1103     RUN(testChillDiv(-2147483647 - 1, -1, -2147483647 - 1));
1104     RUN(testChillDiv(-2147483647 - 1, 2, -1073741824));
1105     RUN(testChillDiv64(4, 2, 2));
1106     RUN(testChillDiv64(1, 0, 0));
1107     RUN(testChillDiv64(0, 0, 0));
1108     RUN(testChillDiv64(1, -1, -1));
1109     RUN(testChillDiv64(-9223372036854775807ll - 1, 0, 0));
1110     RUN(testChillDiv64(-9223372036854775807ll - 1, 1, -9223372036854775807ll - 1));
1111     RUN(testChillDiv64(-9223372036854775807ll - 1, -1, -9223372036854775807ll - 1));
1112     RUN(testChillDiv64(-9223372036854775807ll - 1, 2, -4611686018427387904));
1113     RUN(testChillDivTwice(4, 2, 6, 2, 5));
1114     RUN(testChillDivTwice(4, 0, 6, 2, 3));
1115     RUN(testChillDivTwice(4, 2, 6, 0, 2));
1116
1117     RUN_UNARY(testModArg, int64Operands());
1118     RUN_BINARY(testModArgs, int64Operands(), int64Operands());
1119     RUN_BINARY(testModImms, int64Operands(), int64Operands());
1120     RUN_UNARY(testModArg32, int32Operands());
1121     RUN_BINARY(testModArgs32, int32Operands(), int32Operands());
1122     RUN_BINARY(testModImms32, int32Operands(), int32Operands());
1123     RUN_UNARY(testChillModArg, int64Operands());
1124     RUN_BINARY(testChillModArgs, int64Operands(), int64Operands());
1125     RUN_BINARY(testChillModImms, int64Operands(), int64Operands());
1126     RUN_UNARY(testChillModArg32, int32Operands());
1127     RUN_BINARY(testChillModArgs32, int32Operands(), int32Operands());
1128     RUN_BINARY(testChillModImms32, int32Operands(), int32Operands());
1129
1130     RUN(testSwitch(0, 1));
1131     RUN(testSwitch(1, 1));
1132     RUN(testSwitch(2, 1));
1133     RUN(testSwitch(2, 2));
1134     RUN(testSwitch(10, 1));
1135     RUN(testSwitch(10, 2));
1136     RUN(testSwitch(100, 1));
1137     RUN(testSwitch(100, 100));
1138
1139     RUN(testSwitchSameCaseAsDefault());
1140
1141     RUN(testSwitchChillDiv(0, 1));
1142     RUN(testSwitchChillDiv(1, 1));
1143     RUN(testSwitchChillDiv(2, 1));
1144     RUN(testSwitchChillDiv(2, 2));
1145     RUN(testSwitchChillDiv(10, 1));
1146     RUN(testSwitchChillDiv(10, 2));
1147     RUN(testSwitchChillDiv(100, 1));
1148     RUN(testSwitchChillDiv(100, 100));
1149
1150     RUN(testSwitchTargettingSameBlock());
1151     RUN(testSwitchTargettingSameBlockFoldPathConstant());
1152
1153     RUN(testTrunc(0));
1154     RUN(testTrunc(1));
1155     RUN(testTrunc(-1));
1156     RUN(testTrunc(1000000000000ll));
1157     RUN(testTrunc(-1000000000000ll));
1158     RUN(testTruncFold(0));
1159     RUN(testTruncFold(1));
1160     RUN(testTruncFold(-1));
1161     RUN(testTruncFold(1000000000000ll));
1162     RUN(testTruncFold(-1000000000000ll));
1163     
1164     RUN(testZExt32(0));
1165     RUN(testZExt32(1));
1166     RUN(testZExt32(-1));
1167     RUN(testZExt32(1000000000ll));
1168     RUN(testZExt32(-1000000000ll));
1169     RUN(testZExt32Fold(0));
1170     RUN(testZExt32Fold(1));
1171     RUN(testZExt32Fold(-1));
1172     RUN(testZExt32Fold(1000000000ll));
1173     RUN(testZExt32Fold(-1000000000ll));
1174
1175     RUN(testSExt32(0));
1176     RUN(testSExt32(1));
1177     RUN(testSExt32(-1));
1178     RUN(testSExt32(1000000000ll));
1179     RUN(testSExt32(-1000000000ll));
1180     RUN(testSExt32Fold(0));
1181     RUN(testSExt32Fold(1));
1182     RUN(testSExt32Fold(-1));
1183     RUN(testSExt32Fold(1000000000ll));
1184     RUN(testSExt32Fold(-1000000000ll));
1185
1186     RUN(testTruncZExt32(0));
1187     RUN(testTruncZExt32(1));
1188     RUN(testTruncZExt32(-1));
1189     RUN(testTruncZExt32(1000000000ll));
1190     RUN(testTruncZExt32(-1000000000ll));
1191     RUN(testTruncSExt32(0));
1192     RUN(testTruncSExt32(1));
1193     RUN(testTruncSExt32(-1));
1194     RUN(testTruncSExt32(1000000000ll));
1195     RUN(testTruncSExt32(-1000000000ll));
1196
1197     RUN(testSExt8(0));
1198     RUN(testSExt8(1));
1199     RUN(testSExt8(42));
1200     RUN(testSExt8(-1));
1201     RUN(testSExt8(0xff));
1202     RUN(testSExt8(0x100));
1203     RUN(testSExt8Fold(0));
1204     RUN(testSExt8Fold(1));
1205     RUN(testSExt8Fold(42));
1206     RUN(testSExt8Fold(-1));
1207     RUN(testSExt8Fold(0xff));
1208     RUN(testSExt8Fold(0x100));
1209     RUN(testSExt8SExt8(0));
1210     RUN(testSExt8SExt8(1));
1211     RUN(testSExt8SExt8(42));
1212     RUN(testSExt8SExt8(-1));
1213     RUN(testSExt8SExt8(0xff));
1214     RUN(testSExt8SExt8(0x100));
1215     RUN(testSExt8SExt16(0));
1216     RUN(testSExt8SExt16(1));
1217     RUN(testSExt8SExt16(42));
1218     RUN(testSExt8SExt16(-1));
1219     RUN(testSExt8SExt16(0xff));
1220     RUN(testSExt8SExt16(0x100));
1221     RUN(testSExt8SExt16(0xffff));
1222     RUN(testSExt8SExt16(0x10000));
1223     RUN(testSExt8BitAnd(0, 0));
1224     RUN(testSExt8BitAnd(1, 0));
1225     RUN(testSExt8BitAnd(42, 0));
1226     RUN(testSExt8BitAnd(-1, 0));
1227     RUN(testSExt8BitAnd(0xff, 0));
1228     RUN(testSExt8BitAnd(0x100, 0));
1229     RUN(testSExt8BitAnd(0xffff, 0));
1230     RUN(testSExt8BitAnd(0x10000, 0));
1231     RUN(testSExt8BitAnd(0, 0xf));
1232     RUN(testSExt8BitAnd(1, 0xf));
1233     RUN(testSExt8BitAnd(42, 0xf));
1234     RUN(testSExt8BitAnd(-1, 0xf));
1235     RUN(testSExt8BitAnd(0xff, 0xf));
1236     RUN(testSExt8BitAnd(0x100, 0xf));
1237     RUN(testSExt8BitAnd(0xffff, 0xf));
1238     RUN(testSExt8BitAnd(0x10000, 0xf));
1239     RUN(testSExt8BitAnd(0, 0xff));
1240     RUN(testSExt8BitAnd(1, 0xff));
1241     RUN(testSExt8BitAnd(42, 0xff));
1242     RUN(testSExt8BitAnd(-1, 0xff));
1243     RUN(testSExt8BitAnd(0xff, 0xff));
1244     RUN(testSExt8BitAnd(0x100, 0xff));
1245     RUN(testSExt8BitAnd(0xffff, 0xff));
1246     RUN(testSExt8BitAnd(0x10000, 0xff));
1247     RUN(testSExt8BitAnd(0, 0x80));
1248     RUN(testSExt8BitAnd(1, 0x80));
1249     RUN(testSExt8BitAnd(42, 0x80));
1250     RUN(testSExt8BitAnd(-1, 0x80));
1251     RUN(testSExt8BitAnd(0xff, 0x80));
1252     RUN(testSExt8BitAnd(0x100, 0x80));
1253     RUN(testSExt8BitAnd(0xffff, 0x80));
1254     RUN(testSExt8BitAnd(0x10000, 0x80));
1255     RUN(testBitAndSExt8(0, 0xf));
1256     RUN(testBitAndSExt8(1, 0xf));
1257     RUN(testBitAndSExt8(42, 0xf));
1258     RUN(testBitAndSExt8(-1, 0xf));
1259     RUN(testBitAndSExt8(0xff, 0xf));
1260     RUN(testBitAndSExt8(0x100, 0xf));
1261     RUN(testBitAndSExt8(0xffff, 0xf));
1262     RUN(testBitAndSExt8(0x10000, 0xf));
1263     RUN(testBitAndSExt8(0, 0xff));
1264     RUN(testBitAndSExt8(1, 0xff));
1265     RUN(testBitAndSExt8(42, 0xff));
1266     RUN(testBitAndSExt8(-1, 0xff));
1267     RUN(testBitAndSExt8(0xff, 0xff));
1268     RUN(testBitAndSExt8(0x100, 0xff));
1269     RUN(testBitAndSExt8(0xffff, 0xff));
1270     RUN(testBitAndSExt8(0x10000, 0xff));
1271     RUN(testBitAndSExt8(0, 0xfff));
1272     RUN(testBitAndSExt8(1, 0xfff));
1273     RUN(testBitAndSExt8(42, 0xfff));
1274     RUN(testBitAndSExt8(-1, 0xfff));
1275     RUN(testBitAndSExt8(0xff, 0xfff));
1276     RUN(testBitAndSExt8(0x100, 0xfff));
1277     RUN(testBitAndSExt8(0xffff, 0xfff));
1278     RUN(testBitAndSExt8(0x10000, 0xfff));
1279
1280     RUN(testSExt16(0));
1281     RUN(testSExt16(1));
1282     RUN(testSExt16(42));
1283     RUN(testSExt16(-1));
1284     RUN(testSExt16(0xffff));
1285     RUN(testSExt16(0x10000));
1286     RUN(testSExt16Fold(0));
1287     RUN(testSExt16Fold(1));
1288     RUN(testSExt16Fold(42));
1289     RUN(testSExt16Fold(-1));
1290     RUN(testSExt16Fold(0xffff));
1291     RUN(testSExt16Fold(0x10000));
1292     RUN(testSExt16SExt8(0));
1293     RUN(testSExt16SExt8(1));
1294     RUN(testSExt16SExt8(42));
1295     RUN(testSExt16SExt8(-1));
1296     RUN(testSExt16SExt8(0xffff));
1297     RUN(testSExt16SExt8(0x10000));
1298     RUN(testSExt16SExt16(0));
1299     RUN(testSExt16SExt16(1));
1300     RUN(testSExt16SExt16(42));
1301     RUN(testSExt16SExt16(-1));
1302     RUN(testSExt16SExt16(0xffff));
1303     RUN(testSExt16SExt16(0x10000));
1304     RUN(testSExt16SExt16(0xffffff));
1305     RUN(testSExt16SExt16(0x1000000));
1306     RUN(testSExt16BitAnd(0, 0));
1307     RUN(testSExt16BitAnd(1, 0));
1308     RUN(testSExt16BitAnd(42, 0));
1309     RUN(testSExt16BitAnd(-1, 0));
1310     RUN(testSExt16BitAnd(0xffff, 0));
1311     RUN(testSExt16BitAnd(0x10000, 0));
1312     RUN(testSExt16BitAnd(0xffffff, 0));
1313     RUN(testSExt16BitAnd(0x1000000, 0));
1314     RUN(testSExt16BitAnd(0, 0xf));
1315     RUN(testSExt16BitAnd(1, 0xf));
1316     RUN(testSExt16BitAnd(42, 0xf));
1317     RUN(testSExt16BitAnd(-1, 0xf));
1318     RUN(testSExt16BitAnd(0xffff, 0xf));
1319     RUN(testSExt16BitAnd(0x10000, 0xf));
1320     RUN(testSExt16BitAnd(0xffffff, 0xf));
1321     RUN(testSExt16BitAnd(0x1000000, 0xf));
1322     RUN(testSExt16BitAnd(0, 0xffff));
1323     RUN(testSExt16BitAnd(1, 0xffff));
1324     RUN(testSExt16BitAnd(42, 0xffff));
1325     RUN(testSExt16BitAnd(-1, 0xffff));
1326     RUN(testSExt16BitAnd(0xffff, 0xffff));
1327     RUN(testSExt16BitAnd(0x10000, 0xffff));
1328     RUN(testSExt16BitAnd(0xffffff, 0xffff));
1329     RUN(testSExt16BitAnd(0x1000000, 0xffff));
1330     RUN(testSExt16BitAnd(0, 0x8000));
1331     RUN(testSExt16BitAnd(1, 0x8000));
1332     RUN(testSExt16BitAnd(42, 0x8000));
1333     RUN(testSExt16BitAnd(-1, 0x8000));
1334     RUN(testSExt16BitAnd(0xffff, 0x8000));
1335     RUN(testSExt16BitAnd(0x10000, 0x8000));
1336     RUN(testSExt16BitAnd(0xffffff, 0x8000));
1337     RUN(testSExt16BitAnd(0x1000000, 0x8000));
1338     RUN(testBitAndSExt16(0, 0xf));
1339     RUN(testBitAndSExt16(1, 0xf));
1340     RUN(testBitAndSExt16(42, 0xf));
1341     RUN(testBitAndSExt16(-1, 0xf));
1342     RUN(testBitAndSExt16(0xffff, 0xf));
1343     RUN(testBitAndSExt16(0x10000, 0xf));
1344     RUN(testBitAndSExt16(0xffffff, 0xf));
1345     RUN(testBitAndSExt16(0x1000000, 0xf));
1346     RUN(testBitAndSExt16(0, 0xffff));
1347     RUN(testBitAndSExt16(1, 0xffff));
1348     RUN(testBitAndSExt16(42, 0xffff));
1349     RUN(testBitAndSExt16(-1, 0xffff));
1350     RUN(testBitAndSExt16(0xffff, 0xffff));
1351     RUN(testBitAndSExt16(0x10000, 0xffff));
1352     RUN(testBitAndSExt16(0xffffff, 0xffff));
1353     RUN(testBitAndSExt16(0x1000000, 0xffff));
1354     RUN(testBitAndSExt16(0, 0xfffff));
1355     RUN(testBitAndSExt16(1, 0xfffff));
1356     RUN(testBitAndSExt16(42, 0xfffff));
1357     RUN(testBitAndSExt16(-1, 0xfffff));
1358     RUN(testBitAndSExt16(0xffff, 0xfffff));
1359     RUN(testBitAndSExt16(0x10000, 0xfffff));
1360     RUN(testBitAndSExt16(0xffffff, 0xfffff));
1361     RUN(testBitAndSExt16(0x1000000, 0xfffff));
1362
1363     RUN(testSExt32BitAnd(0, 0));
1364     RUN(testSExt32BitAnd(1, 0));
1365     RUN(testSExt32BitAnd(42, 0));
1366     RUN(testSExt32BitAnd(-1, 0));
1367     RUN(testSExt32BitAnd(0x80000000, 0));
1368     RUN(testSExt32BitAnd(0, 0xf));
1369     RUN(testSExt32BitAnd(1, 0xf));
1370     RUN(testSExt32BitAnd(42, 0xf));
1371     RUN(testSExt32BitAnd(-1, 0xf));
1372     RUN(testSExt32BitAnd(0x80000000, 0xf));
1373     RUN(testSExt32BitAnd(0, 0x80000000));
1374     RUN(testSExt32BitAnd(1, 0x80000000));
1375     RUN(testSExt32BitAnd(42, 0x80000000));
1376     RUN(testSExt32BitAnd(-1, 0x80000000));
1377     RUN(testSExt32BitAnd(0x80000000, 0x80000000));
1378     RUN(testBitAndSExt32(0, 0xf));
1379     RUN(testBitAndSExt32(1, 0xf));
1380     RUN(testBitAndSExt32(42, 0xf));
1381     RUN(testBitAndSExt32(-1, 0xf));
1382     RUN(testBitAndSExt32(0xffff, 0xf));
1383     RUN(testBitAndSExt32(0x10000, 0xf));
1384     RUN(testBitAndSExt32(0xffffff, 0xf));
1385     RUN(testBitAndSExt32(0x1000000, 0xf));
1386     RUN(testBitAndSExt32(0, 0xffff00000000llu));
1387     RUN(testBitAndSExt32(1, 0xffff00000000llu));
1388     RUN(testBitAndSExt32(42, 0xffff00000000llu));
1389     RUN(testBitAndSExt32(-1, 0xffff00000000llu));
1390     RUN(testBitAndSExt32(0x80000000, 0xffff00000000llu));
1391
1392     RUN(testBasicSelect());
1393     RUN(testSelectTest());
1394     RUN(testSelectCompareDouble());
1395     RUN_BINARY(testSelectCompareFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
1396     RUN_BINARY(testSelectCompareFloatToDouble, floatingPointOperands<float>(), floatingPointOperands<float>());
1397     RUN(testSelectDouble());
1398     RUN(testSelectDoubleTest());
1399     RUN(testSelectDoubleCompareDouble());
1400     RUN_BINARY(testSelectDoubleCompareFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
1401     RUN_BINARY(testSelectFloatCompareFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
1402     RUN(testSelectDoubleCompareDoubleWithAliasing());
1403     RUN(testSelectFloatCompareFloatWithAliasing());
1404     RUN(testSelectFold(42));
1405     RUN(testSelectFold(43));
1406     RUN(testSelectInvert());
1407     RUN(testCheckSelect());
1408     RUN(testCheckSelectCheckSelect());
1409     RUN(testCheckSelectAndCSE());
1410     RUN_BINARY(testPowDoubleByIntegerLoop, floatingPointOperands<double>(), int64Operands());
1411
1412     RUN(testTruncOrHigh());
1413     RUN(testTruncOrLow());
1414     RUN(testBitAndOrHigh());
1415     RUN(testBitAndOrLow());
1416
1417     RUN(testBranch64Equal(0, 0));
1418     RUN(testBranch64Equal(1, 1));
1419     RUN(testBranch64Equal(-1, -1));
1420     RUN(testBranch64Equal(1, -1));
1421     RUN(testBranch64Equal(-1, 1));
1422     RUN(testBranch64EqualImm(0, 0));
1423     RUN(testBranch64EqualImm(1, 1));
1424     RUN(testBranch64EqualImm(-1, -1));
1425     RUN(testBranch64EqualImm(1, -1));
1426     RUN(testBranch64EqualImm(-1, 1));
1427     RUN(testBranch64EqualMem(0, 0));
1428     RUN(testBranch64EqualMem(1, 1));
1429     RUN(testBranch64EqualMem(-1, -1));
1430     RUN(testBranch64EqualMem(1, -1));
1431     RUN(testBranch64EqualMem(-1, 1));
1432     RUN(testBranch64EqualMemImm(0, 0));
1433     RUN(testBranch64EqualMemImm(1, 1));
1434     RUN(testBranch64EqualMemImm(-1, -1));
1435     RUN(testBranch64EqualMemImm(1, -1));
1436     RUN(testBranch64EqualMemImm(-1, 1));
1437
1438     RUN(testStore8Load8Z(0));
1439     RUN(testStore8Load8Z(123));
1440     RUN(testStore8Load8Z(12345));
1441     RUN(testStore8Load8Z(-123));
1442
1443     RUN(testStore16Load16Z(0));
1444     RUN(testStore16Load16Z(123));
1445     RUN(testStore16Load16Z(12345));
1446     RUN(testStore16Load16Z(12345678));
1447     RUN(testStore16Load16Z(-123));
1448
1449     RUN(testSShrShl32(42, 24, 24));
1450     RUN(testSShrShl32(-42, 24, 24));
1451     RUN(testSShrShl32(4200, 24, 24));
1452     RUN(testSShrShl32(-4200, 24, 24));
1453     RUN(testSShrShl32(4200000, 24, 24));
1454     RUN(testSShrShl32(-4200000, 24, 24));
1455
1456     RUN(testSShrShl32(42, 16, 16));
1457     RUN(testSShrShl32(-42, 16, 16));
1458     RUN(testSShrShl32(4200, 16, 16));
1459     RUN(testSShrShl32(-4200, 16, 16));
1460     RUN(testSShrShl32(4200000, 16, 16));
1461     RUN(testSShrShl32(-4200000, 16, 16));
1462
1463     RUN(testSShrShl32(42, 8, 8));
1464     RUN(testSShrShl32(-42, 8, 8));
1465     RUN(testSShrShl32(4200, 8, 8));
1466     RUN(testSShrShl32(-4200, 8, 8));
1467     RUN(testSShrShl32(4200000, 8, 8));
1468     RUN(testSShrShl32(-4200000, 8, 8));
1469     RUN(testSShrShl32(420000000, 8, 8));
1470     RUN(testSShrShl32(-420000000, 8, 8));
1471
1472     RUN(testSShrShl64(42, 56, 56));
1473     RUN(testSShrShl64(-42, 56, 56));
1474     RUN(testSShrShl64(4200, 56, 56));
1475     RUN(testSShrShl64(-4200, 56, 56));
1476     RUN(testSShrShl64(4200000, 56, 56));
1477     RUN(testSShrShl64(-4200000, 56, 56));
1478     RUN(testSShrShl64(420000000, 56, 56));
1479     RUN(testSShrShl64(-420000000, 56, 56));
1480     RUN(testSShrShl64(42000000000, 56, 56));
1481     RUN(testSShrShl64(-42000000000, 56, 56));
1482
1483     RUN(testSShrShl64(42, 48, 48));
1484     RUN(testSShrShl64(-42, 48, 48));
1485     RUN(testSShrShl64(4200, 48, 48));
1486     RUN(testSShrShl64(-4200, 48, 48));
1487     RUN(testSShrShl64(4200000, 48, 48));
1488     RUN(testSShrShl64(-4200000, 48, 48));
1489     RUN(testSShrShl64(420000000, 48, 48));
1490     RUN(testSShrShl64(-420000000, 48, 48));
1491     RUN(testSShrShl64(42000000000, 48, 48));
1492     RUN(testSShrShl64(-42000000000, 48, 48));
1493
1494     RUN(testSShrShl64(42, 32, 32));
1495     RUN(testSShrShl64(-42, 32, 32));
1496     RUN(testSShrShl64(4200, 32, 32));
1497     RUN(testSShrShl64(-4200, 32, 32));
1498     RUN(testSShrShl64(4200000, 32, 32));
1499     RUN(testSShrShl64(-4200000, 32, 32));
1500     RUN(testSShrShl64(420000000, 32, 32));
1501     RUN(testSShrShl64(-420000000, 32, 32));
1502     RUN(testSShrShl64(42000000000, 32, 32));
1503     RUN(testSShrShl64(-42000000000, 32, 32));
1504
1505     RUN(testSShrShl64(42, 24, 24));
1506     RUN(testSShrShl64(-42, 24, 24));
1507     RUN(testSShrShl64(4200, 24, 24));
1508     RUN(testSShrShl64(-4200, 24, 24));
1509     RUN(testSShrShl64(4200000, 24, 24));
1510     RUN(testSShrShl64(-4200000, 24, 24));
1511     RUN(testSShrShl64(420000000, 24, 24));
1512     RUN(testSShrShl64(-420000000, 24, 24));
1513     RUN(testSShrShl64(42000000000, 24, 24));
1514     RUN(testSShrShl64(-42000000000, 24, 24));
1515
1516     RUN(testSShrShl64(42, 16, 16));
1517     RUN(testSShrShl64(-42, 16, 16));
1518     RUN(testSShrShl64(4200, 16, 16));
1519     RUN(testSShrShl64(-4200, 16, 16));
1520     RUN(testSShrShl64(4200000, 16, 16));
1521     RUN(testSShrShl64(-4200000, 16, 16));
1522     RUN(testSShrShl64(420000000, 16, 16));
1523     RUN(testSShrShl64(-420000000, 16, 16));
1524     RUN(testSShrShl64(42000000000, 16, 16));
1525     RUN(testSShrShl64(-42000000000, 16, 16));
1526
1527     RUN(testSShrShl64(42, 8, 8));
1528     RUN(testSShrShl64(-42, 8, 8));
1529     RUN(testSShrShl64(4200, 8, 8));
1530     RUN(testSShrShl64(-4200, 8, 8));
1531     RUN(testSShrShl64(4200000, 8, 8));
1532     RUN(testSShrShl64(-4200000, 8, 8));
1533     RUN(testSShrShl64(420000000, 8, 8));
1534     RUN(testSShrShl64(-420000000, 8, 8));
1535     RUN(testSShrShl64(42000000000, 8, 8));
1536     RUN(testSShrShl64(-42000000000, 8, 8));
1537
1538     RUN(testCheckMul64SShr());
1539
1540     RUN_BINARY(testRotR, int32Operands(), int32Operands());
1541     RUN_BINARY(testRotR, int64Operands(), int32Operands());
1542     RUN_BINARY(testRotL, int32Operands(), int32Operands());
1543     RUN_BINARY(testRotL, int64Operands(), int32Operands());
1544
1545     RUN_BINARY(testRotRWithImmShift, int32Operands(), int32Operands());
1546     RUN_BINARY(testRotRWithImmShift, int64Operands(), int32Operands());
1547     RUN_BINARY(testRotLWithImmShift, int32Operands(), int32Operands());
1548     RUN_BINARY(testRotLWithImmShift, int64Operands(), int32Operands());
1549
1550     RUN(testComputeDivisionMagic<int32_t>(2, -2147483647, 0));
1551     RUN(testTrivialInfiniteLoop());
1552     RUN(testFoldPathEqual());
1553     
1554     RUN(testRShiftSelf32());
1555     RUN(testURShiftSelf32());
1556     RUN(testLShiftSelf32());
1557     RUN(testRShiftSelf64());
1558     RUN(testURShiftSelf64());
1559     RUN(testLShiftSelf64());
1560
1561     RUN(testPatchpointDoubleRegs());
1562     RUN(testSpillDefSmallerThanUse());
1563     RUN(testSpillUseLargerThanDef());
1564     RUN(testLateRegister());
1565     RUN(testInterpreter());
1566     RUN(testReduceStrengthCheckBottomUseInAnotherBlock());
1567     RUN(testResetReachabilityDanglingReference());
1568     
1569     RUN(testEntrySwitchSimple());
1570     RUN(testEntrySwitchNoEntrySwitch());
1571     RUN(testEntrySwitchWithCommonPaths());
1572     RUN(testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint());
1573     RUN(testEntrySwitchLoop());
1574
1575     RUN(testSomeEarlyRegister());
1576     RUN(testPatchpointTerminalReturnValue(true));
1577     RUN(testPatchpointTerminalReturnValue(false));
1578     RUN(testTerminalPatchpointThatNeedsToBeSpilled());
1579
1580     RUN(testMemoryFence());
1581     RUN(testStoreFence());
1582     RUN(testLoadFence());
1583     RUN(testTrappingLoad());
1584     RUN(testTrappingStore());
1585     RUN(testTrappingLoadAddStore());
1586     RUN(testTrappingLoadDCE());
1587     RUN(testTrappingStoreElimination());
1588     RUN(testMoveConstants());
1589     RUN(testPCOriginMapDoesntInsertNops());
1590     RUN(testPinRegisters());
1591     RUN(testReduceStrengthReassociation(true));
1592     RUN(testReduceStrengthReassociation(false));
1593     RUN(testAddShl32());
1594     RUN(testAddShl64());
1595     RUN(testAddShl65());
1596     RUN(testLoadBaseIndexShift2());
1597     RUN(testLoadBaseIndexShift32());
1598     RUN(testOptimizeMaterialization());
1599     RUN(testLICMPure());
1600     RUN(testLICMPureSideExits());
1601     RUN(testLICMPureWritesPinned());
1602     RUN(testLICMPureWrites());
1603     RUN(testLICMReadsLocalState());
1604     RUN(testLICMReadsPinned());
1605     RUN(testLICMReads());
1606     RUN(testLICMPureNotBackwardsDominant());
1607     RUN(testLICMPureFoiledByChild());
1608     RUN(testLICMPureNotBackwardsDominantFoiledByChild());
1609     RUN(testLICMExitsSideways());
1610     RUN(testLICMWritesLocalState());
1611     RUN(testLICMWrites());
1612     RUN(testLICMWritesPinned());
1613     RUN(testLICMFence());
1614     RUN(testLICMControlDependent());
1615     RUN(testLICMControlDependentNotBackwardsDominant());
1616     RUN(testLICMControlDependentSideExits());
1617     RUN(testLICMReadsPinnedWritesPinned());
1618     RUN(testLICMReadsWritesDifferentHeaps());
1619     RUN(testLICMReadsWritesOverlappingHeaps());
1620     RUN(testLICMDefaultCall());
1621
1622     addAtomicTests(filter, tasks);
1623     RUN(testDepend32());
1624     RUN(testDepend64());
1625
1626     RUN(testWasmBoundsCheck(0));
1627     RUN(testWasmBoundsCheck(100));
1628     RUN(testWasmBoundsCheck(10000));
1629     RUN(testWasmBoundsCheck(std::numeric_limits<unsigned>::max() - 5));
1630
1631     RUN(testWasmAddress());
1632     
1633     RUN(testFastTLSLoad());
1634     RUN(testFastTLSStore());
1635
1636     RUN(testDoubleLiteralComparison(bitwise_cast<double>(0x8000000000000001ull), bitwise_cast<double>(0x0000000000000000ull)));
1637     RUN(testDoubleLiteralComparison(bitwise_cast<double>(0x0000000000000000ull), bitwise_cast<double>(0x8000000000000001ull)));
1638     RUN(testDoubleLiteralComparison(125.3144446948241, 125.3144446948242));
1639     RUN(testDoubleLiteralComparison(125.3144446948242, 125.3144446948241));
1640
1641     RUN(testFloatEqualOrUnorderedFolding());
1642     RUN(testFloatEqualOrUnorderedFoldingNaN());
1643     RUN(testFloatEqualOrUnorderedDontFold());
1644     
1645     RUN(testShuffleDoesntTrashCalleeSaves());
1646     RUN(testDemotePatchpointTerminal());
1647
1648     RUN(testLoopWithMultipleHeaderEdges());
1649
1650     RUN(testInfiniteLoopDoesntCauseBadHoisting());
1651
1652     if (isX86()) {
1653         RUN(testBranchBitAndImmFusion(Identity, Int64, 1, Air::BranchTest32, Air::Arg::Tmp));
1654         RUN(testBranchBitAndImmFusion(Identity, Int64, 0xff, Air::BranchTest32, Air::Arg::Tmp));
1655         RUN(testBranchBitAndImmFusion(Trunc, Int32, 1, Air::BranchTest32, Air::Arg::Tmp));
1656         RUN(testBranchBitAndImmFusion(Trunc, Int32, 0xff, Air::BranchTest32, Air::Arg::Tmp));
1657         RUN(testBranchBitAndImmFusion(Load8S, Int32, 1, Air::BranchTest8, Air::Arg::Addr));
1658         RUN(testBranchBitAndImmFusion(Load8Z, Int32, 1, Air::BranchTest8, Air::Arg::Addr));
1659         RUN(testBranchBitAndImmFusion(Load, Int32, 1, Air::BranchTest32, Air::Arg::Addr));
1660         RUN(testBranchBitAndImmFusion(Load, Int64, 1, Air::BranchTest32, Air::Arg::Addr));
1661         RUN(testX86LeaAddAddShlLeft());
1662         RUN(testX86LeaAddAddShlRight());
1663         RUN(testX86LeaAddAdd());
1664         RUN(testX86LeaAddShlRight());
1665         RUN(testX86LeaAddShlLeftScale1());
1666         RUN(testX86LeaAddShlLeftScale2());
1667         RUN(testX86LeaAddShlLeftScale4());
1668         RUN(testX86LeaAddShlLeftScale8());
1669     }
1670
1671     if (isARM64()) {
1672         RUN(testTernarySubInstructionSelection(Identity, Int64, Air::Sub64));
1673         RUN(testTernarySubInstructionSelection(Trunc, Int32, Air::Sub32));
1674     }
1675
1676     RUN(testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead());
1677
1678     if (tasks.isEmpty())
1679         usage();
1680
1681     Lock lock;
1682
1683     Vector<Ref<Thread>> threads;
1684     for (unsigned i = filter ? 1 : WTF::numberOfProcessorCores(); i--;) {
1685         threads.append(
1686             Thread::create(
1687                 "testb3 thread",
1688                 [&] () {
1689                     for (;;) {
1690                         RefPtr<SharedTask<void()>> task;
1691                         {
1692                             LockHolder locker(lock);
1693                             if (tasks.isEmpty())
1694                                 return;
1695                             task = tasks.takeFirst();
1696                         }
1697
1698                         task->run();
1699                     }
1700                 }));
1701     }
1702
1703     for (auto& thread : threads)
1704         thread->waitForCompletion();
1705     crashLock.lock();
1706     crashLock.unlock();
1707 }
1708
1709 #else // ENABLE(B3_JIT)
1710
1711 static void run(const char*)
1712 {
1713     dataLog("B3 JIT is not enabled.\n");
1714 }
1715
1716 #endif // ENABLE(B3_JIT)
1717
1718 int main(int argc, char** argv)
1719 {
1720     const char* filter = nullptr;
1721     switch (argc) {
1722     case 1:
1723         break;
1724     case 2:
1725         filter = argv[1];
1726         break;
1727     default:
1728         usage();
1729         break;
1730     }
1731
1732     JSC::initializeThreading();
1733     
1734     for (unsigned i = 0; i <= 2; ++i) {
1735         JSC::Options::defaultB3OptLevel() = i;
1736         run(filter);
1737     }
1738
1739     return 0;
1740 }
1741
1742 #if OS(WINDOWS)
1743 extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, const char* argv[])
1744 {
1745     return main(argc, const_cast<char**>(argv));
1746 }
1747 #endif