Add more tests (8 tests ara failed on 32-bit x86)

This commit is contained in:
Dmitry Stogov 2022-11-08 11:56:22 +03:00
parent cc56f12f13
commit 37dececa71
394 changed files with 12858 additions and 0 deletions

18
tests/aarch64/abs_001.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
001: abs function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = ABS(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0
cneg w0, w0, lt
ret

17
tests/aarch64/abs_002.irt Normal file
View File

@ -0,0 +1,17 @@
--TEST--
002: abs function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double ret = ABS(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fabs d0, d0
ret

17
tests/aarch64/abs_003.irt Normal file
View File

@ -0,0 +1,17 @@
--TEST--
003: abs function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
float x = PARAM(l_1, "x", 1);
float ret = ABS(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fabs s0, s0
ret

18
tests/aarch64/add_001.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
001: add function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
int32_t ret = ADD(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
add w0, w1, w0
ret

18
tests/aarch64/add_002.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
002: add function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = ADD(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
add w0, w0, #0x11
ret

18
tests/aarch64/add_003.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
003: add function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
int32_t ret = ADD(y, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
add w0, w1, w0
ret

18
tests/aarch64/add_004.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
004: add function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = ADD(c, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
add w0, w0, #0x11
ret

18
tests/aarch64/add_005.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
005: add function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double y = PARAM(l_1, "y", 2);
double ret = ADD(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fadd d0, d1, d0
ret

18
tests/aarch64/add_006.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
006: add function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double y = PARAM(l_1, "y", 2);
double ret = ADD(y, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fadd d0, d1, d0
ret

18
tests/aarch64/add_007.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
007: add function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double y = PARAM(l_1, "y", 2);
double ret = ADD(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fadd d0, d1, d0
ret

18
tests/aarch64/add_008.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
008: add function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double y = PARAM(l_1, "y", 2);
double ret = ADD(y, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fadd d0, d1, d0
ret

19
tests/aarch64/add_009.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
009: add function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint64_t c = 0x100000000;
l_1 = START(l_4);
uint64_t x = PARAM(l_1, "x", 1);
uint64_t ret = ADD(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
movz x1, #0x1, lsl #32
add x0, x0, x1
ret

18
tests/aarch64/add_010.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
010: add function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint16_t c = 1;
l_1 = START(l_4);
uint16_t x = PARAM(l_1, "x", 1);
uint16_t ret = ADD(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
add w0, w0, #1
ret

23
tests/aarch64/add_011.irt Normal file
View File

@ -0,0 +1,23 @@
--TEST--
011: add function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
double c = 0.5;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double ret = ADD(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
ldr d1, .L1
fadd d0, d0, d1
ret
.rodata
.db 0x1f, 0x20, 0x03, 0xd5
.L1:
.db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f

23
tests/aarch64/add_012.irt Normal file
View File

@ -0,0 +1,23 @@
--TEST--
012: add function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
double c = 0.5;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double ret = ADD(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
ldr d1, .L1
fadd d0, d0, d1
ret
.rodata
.db 0x1f, 0x20, 0x03, 0xd5
.L1:
.db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f

View File

@ -0,0 +1,20 @@
--TEST--
001: add_ov function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 2;
l_1 = START(l_2);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = ADD_OV(x, c);
bool ov = OVERFLOW(ret);
l_2 = RETURN(l_1, ov);
}
--EXPECT--
test:
adds w0, w0, #2
cset w0, vs
ret

View File

@ -0,0 +1,20 @@
--TEST--
002: add_ov function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint32_t c = 2;
l_1 = START(l_2);
uint32_t x = PARAM(l_1, "x", 1);
uint32_t ret = ADD_OV(x, c);
bool ov = OVERFLOW(ret);
l_2 = RETURN(l_1, ov);
}
--EXPECT--
test:
adds w0, w0, #2
cset w0, hs
ret

View File

@ -0,0 +1,30 @@
--TEST--
003: add_ov function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c_1 = 0;
int32_t c = 2;
l_1 = START(l_8);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret1 = ADD_OV(x, c);
bool ov = OVERFLOW(ret1);
l_2 = IF(l_1, ov);
l_3 = IF_TRUE(l_2);
l_4 = END(l_3);
l_5 = IF_FALSE(l_2);
l_6 = END(l_5);
l_7 = MERGE(l_4, l_6);
int32_t ret = PHI(l_7, c_1, ret1);
l_8 = RETURN(l_7, ret);
}
--EXPECT--
test:
adds w0, w0, #2
b.vc .L1
mov w0, wzr
.L1:
ret

View File

@ -0,0 +1,32 @@
--TEST--
004: add_ov function (jmp probability)
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c_1 = 0;
int32_t c = 2;
l_1 = START(l_8);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret1 = ADD_OV(x, c);
bool ov = OVERFLOW(ret1);
l_2 = IF(l_1, ov);
l_3 = IF_TRUE(l_2, 1);
l_4 = END(l_3);
l_5 = IF_FALSE(l_2);
l_6 = END(l_5);
l_7 = MERGE(l_4, l_6);
int32_t ret = PHI(l_7, c_1, ret1);
l_8 = RETURN(l_7, ret);
}
--EXPECT--
test:
adds w0, w0, #2
b.vs .L2
.L1:
ret
.L2:
mov w0, wzr
b .L1

View File

@ -0,0 +1,22 @@
--TEST--
001: alloca function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t size = 10;
l_1 = START(l_4);
uintptr_t ret, l_2 = ALLOCA(l_1, size);
l_4 = RETURN(l_2, ret);
}
--EXPECT--
test:
stp x29, x30, [sp, #-0x10]!
mov x29, sp
sub sp, sp, #0x10
mov x0, sp
mov sp, x29
ldp x29, x30, [sp], #0x10
ret

View File

@ -0,0 +1,24 @@
--TEST--
002: alloca function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
uintptr_t ret, l_2 = ALLOCA(l_1, x);
l_4 = RETURN(l_2, ret);
}
--EXPECT--
test:
stp x29, x30, [sp, #-0x10]!
mov x29, sp
add x0, x0, #7
and x0, x0, #0xfffffffffffffff8
sub sp, sp, x0
mov x0, sp
mov sp, x29
ldp x29, x30, [sp], #0x10
ret

View File

@ -0,0 +1,17 @@
--TEST--
001: bswap function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = BSWAP(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
rev w0, w0
ret

View File

@ -0,0 +1,17 @@
--TEST--
001: type conversion SEXT
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int64_t ret = SEXT(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
sxtw x0, w0
ret

View File

@ -0,0 +1,17 @@
--TEST--
002: type conversion ZEXT
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint32_t x = PARAM(l_1, "x", 1);
uint64_t ret = ZEXT(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
mov w0, w0
ret

View File

@ -0,0 +1,16 @@
--TEST--
003: type conversion BITCAST
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
uint32_t ret = BITCAST(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
ret

View File

@ -0,0 +1,17 @@
--TEST--
004: type conversion BITCAST
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
uint64_t ret = BITCAST(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov x0, d0
ret

View File

@ -0,0 +1,17 @@
--TEST--
005: type conversion BITCAST
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
float x = PARAM(l_1, "x", 1);
uint32_t ret = BITCAST(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov w0, s0
ret

View File

@ -0,0 +1,17 @@
--TEST--
006: type conversion INT2FP
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
double ret = INT2FP(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
scvtf d0, w0
ret

View File

@ -0,0 +1,17 @@
--TEST--
007: type conversion FP2INT
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
float x = PARAM(l_1, "x", 1);
uint32_t ret = FP2INT(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fcvtzu w0, s0
ret

View File

@ -0,0 +1,17 @@
--TEST--
008: type conversion FP2FP
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
float x = PARAM(l_1, "x", 1);
double ret = FP2FP(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fcvt d0, s0
ret

View File

@ -0,0 +1,17 @@
--TEST--
009: type conversion FP2FP
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
float ret = FP2FP(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fcvt s0, d0
ret

View File

@ -0,0 +1,17 @@
--TEST--
010: type conversion BITCAST
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint64_t x = PARAM(l_1, "x", 1);
double ret = BITCAST(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d0, x0
ret

View File

@ -0,0 +1,16 @@
--TEST--
011: type conversion TRUNC
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int8_t ret = TRUNC(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
ret

18
tests/aarch64/div_001.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
001: div function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
int32_t ret = DIV(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
sdiv w0, w0, w1
ret

19
tests/aarch64/div_002.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
002: div function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = DIV(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
movz w1, #0x11
sdiv w0, w0, w1
ret

18
tests/aarch64/div_003.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
003: div function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
int32_t ret = DIV(y, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
sdiv w0, w1, w0
ret

19
tests/aarch64/div_004.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
004: div function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = DIV(c, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
movz w1, #0x11
sdiv w0, w1, w0
ret

18
tests/aarch64/div_005.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
005: div function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint32_t c = 16;
l_1 = START(l_4);
uint32_t x = PARAM(l_1, "x", 1);
uint32_t ret = DIV(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
lsr w0, w0, #4
ret

18
tests/aarch64/div_006.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
006: div function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint32_t x = PARAM(l_1, "x", 1);
uint32_t y = PARAM(l_1, "y", 2);
uint32_t ret = DIV(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
udiv w0, w0, w1
ret

19
tests/aarch64/eq_001.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
001: eq function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
bool ret = EQ(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w1, w0
cset w0, eq
ret

19
tests/aarch64/eq_002.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
002: eq function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = EQ(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0x11
cset w0, eq
ret

19
tests/aarch64/eq_003.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
003: eq function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 0;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = EQ(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0
cset w0, eq
ret

20
tests/aarch64/eq_004.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
004: eq function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = EQ(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d0, d1
cset w0, eq
ret

20
tests/aarch64/eq_005.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
005: eq function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = EQ(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d0, d1
cset w0, eq
ret

19
tests/aarch64/ge_001.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
001: ge function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
bool ret = GE(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w1, w0
cset w0, le
ret

19
tests/aarch64/ge_002.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
002: ge function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = GE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0x11
cset w0, ge
ret

19
tests/aarch64/ge_003.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
003: ge function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 0;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = GE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0
cset w0, ge
ret

20
tests/aarch64/ge_004.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
004: ge function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = GE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d0, d1
cset w0, ge
ret

20
tests/aarch64/ge_005.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
005: ge function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = GE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d0, d1
cset w0, ge
ret

19
tests/aarch64/gt_001.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
001: gt function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
bool ret = GT(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w1, w0
cset w0, lt
ret

19
tests/aarch64/gt_002.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
002: gt function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = GT(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0x11
cset w0, gt
ret

19
tests/aarch64/gt_003.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
003: gt function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 0;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = GT(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0
cset w0, gt
ret

20
tests/aarch64/gt_004.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
004: gt function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = GT(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d0, d1
cset w0, gt
ret

20
tests/aarch64/gt_005.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
005: gt function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = GT(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d0, d1
cset w0, gt
ret

31
tests/aarch64/if_001.irt Normal file
View File

@ -0,0 +1,31 @@
--TEST--
001: if function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c_1 = 0;
int32_t c_2 = 42;
l_1 = START(l_8);
int32_t x = PARAM(l_1, "x", 1);
l_2 = IF(l_1, x);
l_3 = IF_TRUE(l_2);
l_4 = END(l_3);
l_5 = IF_FALSE(l_2);
l_6 = END(l_5);
l_7 = MERGE(l_4, l_6);
int32_t ret = PHI(l_7, c_1, c_2);
l_8 = RETURN(l_7, ret);
}
--EXPECT--
test:
cmp w0, #0
b.eq .L2
mov w0, wzr
.L1:
ret
.L2:
movz w0, #0x2a
b .L1

19
tests/aarch64/le_001.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
001: le function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
bool ret = LE(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w1, w0
cset w0, ge
ret

19
tests/aarch64/le_002.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
002: le function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = LE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0x11
cset w0, le
ret

19
tests/aarch64/le_003.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
003: le function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 0;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = LE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0
cset w0, le
ret

20
tests/aarch64/le_004.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
004: le function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = LE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d1, d0
cset w0, ge
ret

20
tests/aarch64/le_005.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
005: le function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = LE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d1, d0
cset w0, ge
ret

19
tests/aarch64/lt_001.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
001: lt function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
bool ret = LT(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w1, w0
cset w0, gt
ret

19
tests/aarch64/lt_002.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
002: lt function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = LT(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0x11
cset w0, lt
ret

19
tests/aarch64/lt_003.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
003: lt function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 0;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = LT(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0
cset w0, lt
ret

20
tests/aarch64/lt_004.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
004: lt function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = LT(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d1, d0
cset w0, gt
ret

20
tests/aarch64/lt_005.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
005: lt function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = LT(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d1, d0
cset w0, gt
ret

18
tests/aarch64/min_001.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
001: min function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
float x = PARAM(l_1, "x", 1);
float y = PARAM(l_1, "y", 2);
float ret = MIN(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmin s0, s1, s0
ret

18
tests/aarch64/min_002.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
002: min function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
l_1 = START(l_4);
float x = PARAM(l_1, "x", 1);
float y = PARAM(l_1, "y", 2);
float ret = MIN(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmin s0, s1, s0
ret

18
tests/aarch64/min_003.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
003: min function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double y = PARAM(l_1, "y", 2);
double ret = MIN(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmin d0, d1, d0
ret

18
tests/aarch64/min_004.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
004: min function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double y = PARAM(l_1, "y", 2);
double ret = MIN(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmin d0, d1, d0
ret

19
tests/aarch64/min_005.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
005: min function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
int32_t ret = MIN(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w1, w0
csel w0, w1, w0, le
ret

19
tests/aarch64/min_006.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
006: min function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint8_t x = PARAM(l_1, "x", 1);
uint8_t y = PARAM(l_1, "y", 2);
uint8_t ret = MIN(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w1, w0
csel w0, w1, w0, ls
ret

20
tests/aarch64/min_007.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
007: min function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 47;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = MIN(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
movz w1, #0x2f
cmp w0, w1
csel w0, w0, w1, le
ret

19
tests/aarch64/mod_001.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
001: mod function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
int32_t ret = MOD(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
sdiv w2, w0, w1
msub w0, w2, w1, w0
ret

20
tests/aarch64/mod_002.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
002: mod function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = MOD(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
movz w2, #0x11
sdiv w1, w0, w2
msub w0, w1, w2, w0
ret

19
tests/aarch64/mod_003.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
003: mod function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
int32_t ret = MOD(y, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
sdiv w2, w1, w0
msub w0, w2, w0, w1
ret

20
tests/aarch64/mod_004.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
004: mod function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = MOD(c, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
movz w2, #0x11
sdiv w1, w2, w0
msub w0, w1, w0, w2
ret

18
tests/aarch64/mod_005.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
005: mod function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint32_t c = 16;
l_1 = START(l_4);
uint32_t x = PARAM(l_1, "x", 1);
uint32_t ret = MOD(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
and w0, w0, #0xf
ret

18
tests/aarch64/mul_001.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
001: mul function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint32_t x = PARAM(l_1, "x", 1);
uint32_t y = PARAM(l_1, "y", 2);
uint32_t ret = MUL(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
mul w0, w1, w0
ret

19
tests/aarch64/mul_002.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
002: mul function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint32_t c = 17;
l_1 = START(l_4);
uint32_t x = PARAM(l_1, "x", 1);
uint32_t ret = MUL(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
movz w1, #0x11
mul w0, w0, w1
ret

18
tests/aarch64/mul_003.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
003: mul function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint32_t x = PARAM(l_1, "x", 1);
uint32_t y = PARAM(l_1, "y", 2);
uint32_t ret = MUL(y, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
mul w0, w1, w0
ret

19
tests/aarch64/mul_004.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
004: mul function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint32_t c = 17;
l_1 = START(l_4);
uint32_t x = PARAM(l_1, "x", 1);
uint32_t ret = MUL(c, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
movz w1, #0x11
mul w0, w0, w1
ret

18
tests/aarch64/mul_005.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
005: mul function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint32_t c = 2;
l_1 = START(l_4);
uint16_t x = PARAM(l_1, "x", 1);
uint16_t ret = MUL(c, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
add w0, w0, w0
ret

18
tests/aarch64/mul_006.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
006: mul function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint32_t c = 16;
l_1 = START(l_4);
uint16_t x = PARAM(l_1, "x", 1);
uint16_t ret = MUL(c, x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
lsl w0, w0, #4
ret

18
tests/aarch64/mul_007.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
007: mul function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
int32_t ret = MUL(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
mul w0, w1, w0
ret

View File

@ -0,0 +1,23 @@
--TEST--
001: mul_ov function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 2;
l_1 = START(l_2);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = MUL_OV(x, c);
bool ov = OVERFLOW(ret);
l_2 = RETURN(l_1, ov);
}
--EXPECT--
test:
movz w2, #0x2
smull x0, w0, w2
asr x1, x0, #0x20
cmp x1, x0, asr #31
cset w0, ne
ret

View File

@ -0,0 +1,22 @@
--TEST--
002: mul_ov function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
uint32_t c = 2;
l_1 = START(l_2);
uint32_t x = PARAM(l_1, "x", 1);
uint32_t ret = MUL_OV(x, c);
bool ov = OVERFLOW(ret);
l_2 = RETURN(l_1, ov);
}
--EXPECT--
test:
movz w1, #0x2
umull x0, w0, w1
cmp xzr, x0, lsr #32
cset w0, ne
ret

19
tests/aarch64/ne_001.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
001: ne function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t y = PARAM(l_1, "y", 2);
bool ret = NE(x, y);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w1, w0
cset w0, ne
ret

19
tests/aarch64/ne_002.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
002: ne function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 17;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = NE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0x11
cset w0, ne
ret

19
tests/aarch64/ne_003.irt Normal file
View File

@ -0,0 +1,19 @@
--TEST--
003: ne function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
int32_t c = 0;
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
bool ret = NE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w0, #0
cset w0, ne
ret

20
tests/aarch64/ne_004.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
004: ne function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = NE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d0, d1
cset w0, ne
ret

20
tests/aarch64/ne_005.irt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
005: ne function
--TARGET--
aarch64
--ARGS--
-S -mavx
--CODE--
{
double c = 0;
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
bool ret = NE(x, c);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fmov d1, xzr
fcmp d0, d1
cset w0, ne
ret

17
tests/aarch64/neg_001.irt Normal file
View File

@ -0,0 +1,17 @@
--TEST--
001: neg function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = NEG(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
neg w0, w0
ret

17
tests/aarch64/neg_002.irt Normal file
View File

@ -0,0 +1,17 @@
--TEST--
002: neg function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
double x = PARAM(l_1, "x", 1);
double ret = NEG(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fneg d0, d0
ret

17
tests/aarch64/neg_003.irt Normal file
View File

@ -0,0 +1,17 @@
--TEST--
003: neg function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
float x = PARAM(l_1, "x", 1);
float ret = NEG(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
fneg s0, s0
ret

17
tests/aarch64/not_001.irt Normal file
View File

@ -0,0 +1,17 @@
--TEST--
001: not function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
int32_t x = PARAM(l_1, "x", 1);
int32_t ret = NOT(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
mvn w0, w0
ret

18
tests/aarch64/not_002.irt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
002: not function
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
bool x = PARAM(l_1, "x", 1);
bool ret = NOT(x);
l_4 = RETURN(l_1, ret);
}
--EXPECT--
test:
cmp w2, #0
cset w0, eq
ret

21
tests/aarch64/ra_001.irt Normal file
View File

@ -0,0 +1,21 @@
--TEST--
001: Register Allocation (MUL + MUL)
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint32_t x_1 = PARAM(l_1, "x", 1);
uint32_t y_1 = PARAM(l_1, "y", 2);
uint32_t z_1 = PARAM(l_1, "z", 3);
uint32_t x_2 = MUL(x_1, y_1);
uint32_t x_3 = MUL(x_2, z_1);
l_4 = RETURN(l_1, x_3);
}
--EXPECT--
test:
mul w0, w1, w0
mul w0, w0, w2
ret

21
tests/aarch64/ra_002.irt Normal file
View File

@ -0,0 +1,21 @@
--TEST--
002: Register Allocation (MUL + DIV)
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint32_t x_1 = PARAM(l_1, "x", 1);
uint32_t y_1 = PARAM(l_1, "y", 2);
uint32_t z_1 = PARAM(l_1, "z", 3);
uint32_t x_2 = MUL(x_1, y_1);
uint32_t x_3 = DIV(x_2, z_1);
l_4 = RETURN(l_1, x_3);
}
--EXPECT--
test:
mul w0, w1, w0
udiv w0, w0, w2
ret

22
tests/aarch64/ra_003.irt Normal file
View File

@ -0,0 +1,22 @@
--TEST--
003: Register Allocation (MUL + MOD)
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint32_t x_1 = PARAM(l_1, "x", 1);
uint32_t y_1 = PARAM(l_1, "y", 2);
uint32_t z_1 = PARAM(l_1, "z", 3);
uint32_t x_2 = MUL(x_1, y_1);
uint32_t x_3 = MOD(x_2, z_1);
l_4 = RETURN(l_1, x_3);
}
--EXPECT--
test:
mul w0, w1, w0
udiv w1, w0, w2
msub w0, w1, w2, w0
ret

21
tests/aarch64/ra_004.irt Normal file
View File

@ -0,0 +1,21 @@
--TEST--
004: Register Allocation (DIV + MUL)
--TARGET--
aarch64
--ARGS--
-S
--CODE--
{
l_1 = START(l_4);
uint32_t x_1 = PARAM(l_1, "x", 1);
uint32_t y_1 = PARAM(l_1, "y", 2);
uint32_t z_1 = PARAM(l_1, "z", 3);
uint32_t x_2 = DIV(x_1, y_1);
uint32_t x_3 = MUL(x_2, z_1);
l_4 = RETURN(l_1, x_3);
}
--EXPECT--
test:
udiv w0, w0, w1
mul w0, w0, w2
ret

Some files were not shown because too many files have changed in this diff Show More