Files
c3c/test/test_suite/asm/asm_imm_err_rv.c3
Chuck Benedict e1bbab3831 RISCV: Correct auipc imm; clarify signed imm error; add imm negative t… (#1378)
RISCV: Correct auipc imm; claify signed imm error; add imm negative tests. Allow fitted int asm imm const in uints; add rv regs
2024-08-25 11:19:30 +02:00

59 lines
792 B
Plaintext

// #target: elf-riscv32
module test;
fn void test1()
{
asm
{
andi $s1, $s2, -2049; // #error: 'andi' expected 'short' limited to 12 bits.
}
}
fn void test2()
{
asm
{
ori $t0, $t1, 2048; // #error: 'ori' expected 'short' limited to 12 bits.
}
}
fn void test3()
{
asm
{
slli $a0, $a1, 32u; // #error: 'slli' expected 'char' limited to 5 bits.
}
}
fn void test4()
{
asm
{
lui $a0, 0xFFFFFF; // #error: 'lui' expected 'uint' limited to 20 bits.
}
}
fn void test5()
{
asm
{
lui $a0, -1; // #error: 'lui' expected 'uint' limited to 20 bits.
}
}
fn void test6()
{
asm
{
auipc $a0, -1; // #error: 'auipc' expected 'uint' limited to 20 bits.
}
}
fn void test7()
{
asm
{
slli $a0, 1, 31u; // #error: 'slli' does not support a direct integer constant here.
}
}