From: Richard Sandiford Date: Fri, 25 Sep 2015 11:54:22 +0000 (+0000) Subject: [AArch64] Force __builtin_aarch64_fp[sc]r argument into a REG X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6cf8d65b5839c8964588deb807eda6314a07640;p=gcc.git [AArch64] Force __builtin_aarch64_fp[sc]r argument into a REG The testcase triggered an ICE because the builtin expansion code passed the output of expand_normal directly to the SET_FP[SC]R generator, without forcing it into a register first. gcc/ * config/aarch64/aarch64-builtins.c (aarch64_expand_builtin): Force __builtin_aarch64_fp[sc]r arguments into a register. gcc/testsuite/ * gcc.target/aarch64/fpcr_fpsr_1.c: New file. From-SVN: r228116 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fbc353d381d..97b6cdc4fe7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-09-25 Richard Sandiford + + * config/aarch64/aarch64-builtins.c (aarch64_expand_builtin): Force + __builtin_aarch64_fp[sc]r arguments into a register. + 2015-09-25 H.J. Lu * config.gcc (x86_archs): Replace lakemount with lakemont. diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index 4ed2a8b6cb0..80916a9fca2 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -1171,7 +1171,7 @@ aarch64_expand_builtin (tree exp, icode = (fcode == AARCH64_BUILTIN_SET_FPSR) ? CODE_FOR_set_fpsr : CODE_FOR_set_fpcr; arg0 = CALL_EXPR_ARG (exp, 0); - op0 = expand_normal (arg0); + op0 = force_reg (SImode, expand_normal (arg0)); pat = GEN_FCN (icode) (op0); } emit_insn (pat); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 325a692f15a..07858088f7d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-09-25 Richard Sandiford + + * gcc.target/aarch64/fpcr_fpsr_1.c: New file. + 2015-09-25 H.J. Lu * gcc.target/i386/pr66749.c (dg-options): Replace diff --git a/gcc/testsuite/gcc.target/aarch64/fpcr_fpsr_1.c b/gcc/testsuite/gcc.target/aarch64/fpcr_fpsr_1.c new file mode 100644 index 00000000000..29aa1f4cc96 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fpcr_fpsr_1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +f1 (int *x) +{ + __builtin_aarch64_set_fpsr (*x); +} + +void +f2 (int *x) +{ + __builtin_aarch64_set_fpcr (*x); +} + +void +f3 (int *x) +{ + *x = __builtin_aarch64_get_fpsr (); +} + +void +f4 (int *x) +{ + *x = __builtin_aarch64_get_fpcr (); +}