RISC-V: Fixbug for fsflags instruction error using immediate.
The pattern mistakenly believes that fsflags can use immediate numbers, but in fact it does not support it. Immediate numbers should use fsflagsi. For example: __builtin_riscv_fsflags(4); The following error occurred. /tmp/ccoWdWqT.s: Assembler messages: /tmp/ccoWdWqT.s:14: Error: illegal operands `fsflags 4' gcc/ChangeLog: * config/riscv/riscv.md: Likewise. gcc/testsuite/ChangeLog: * gcc.target/riscv/fsflags.c: New test.
This commit is contained in:
parent
645c67f80c
commit
ad0dde0af1
2 changed files with 18 additions and 2 deletions
|
@ -3074,7 +3074,7 @@
|
|||
"frcsr\t%0")
|
||||
|
||||
(define_insn "riscv_fscsr"
|
||||
[(unspec_volatile [(match_operand:SI 0 "csr_operand" "rK")] UNSPECV_FSCSR)]
|
||||
[(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] UNSPECV_FSCSR)]
|
||||
"TARGET_HARD_FLOAT || TARGET_ZFINX"
|
||||
"fscsr\t%0")
|
||||
|
||||
|
@ -3087,7 +3087,7 @@
|
|||
(define_insn "riscv_fsflags"
|
||||
[(unspec_volatile [(match_operand:SI 0 "csr_operand" "rK")] UNSPECV_FSFLAGS)]
|
||||
"TARGET_HARD_FLOAT || TARGET_ZFINX"
|
||||
"fsflags\t%0")
|
||||
"fsflags%i0\t%0")
|
||||
|
||||
(define_insn "*riscv_fsnvsnan<mode>2"
|
||||
[(unspec_volatile [(match_operand:ANYF 0 "register_operand" "f")
|
||||
|
|
16
gcc/testsuite/gcc.target/riscv/fsflags.c
Normal file
16
gcc/testsuite/gcc.target/riscv/fsflags.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* Verify that fsflags is using the correct register or immediate. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-require-effective-target hard_float } */
|
||||
/* { dg-options "-O" } */
|
||||
|
||||
void foo1 (int a)
|
||||
{
|
||||
__builtin_riscv_fsflags(a);
|
||||
}
|
||||
void foo2 ()
|
||||
{
|
||||
__builtin_riscv_fsflags(4);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "fsflags\t" 1 } } */
|
||||
/* { dg-final { scan-assembler-times "fsflagsi\t" 1 } } */
|
Loading…
Add table
Reference in a new issue