mirror of
https://github.com/danog/ir.git
synced 2024-12-11 16:59:46 +01:00
7058c41411
This also fixes possbile incorrect register-allocation/code-generation for SHIFT instuction on x86[_64]
31 lines
548 B
Plaintext
31 lines
548 B
Plaintext
--TEST--
|
|
002: Swap operands of commutative instruction
|
|
--TARGET--
|
|
x86
|
|
--ARGS--
|
|
-S
|
|
--CODE--
|
|
{
|
|
l_1 = START(l_5);
|
|
int32_t x = PARAM(l_1, "x", 1);
|
|
int32_t y = PARAM(l_1, "y", 2);
|
|
int32_t v = VAR(l_1, "_spill_");
|
|
l_2 = VSTORE(l_1, v, y);
|
|
int32_t z, l_3 = VLOAD(l_2, v);
|
|
int32_t ret = AND(z, x);
|
|
int32_t ret2 = ADD(ret, ret);
|
|
l_4 = VSTORE(l_3, v, ret2);
|
|
l_5 = RETURN(l_4);
|
|
}
|
|
--EXPECT--
|
|
test:
|
|
subl $4, %esp
|
|
movl 0xc(%esp), %eax
|
|
movl %eax, (%esp)
|
|
movl 8(%esp), %eax
|
|
andl (%esp), %eax
|
|
addl %eax, %eax
|
|
movl %eax, (%esp)
|
|
addl $4, %esp
|
|
retl
|