Merge aosp-toolchain/gcc/gcc-4_9 changes.
[official-gcc.git] / gcc-4_9 / gcc / testsuite / gcc.target / nios2 / custom-fp-7.c
blob6f17336fbb97eddfc8a4f26b42c76a741a21e849
1 /* Test that duplicate declarations with the same custom insn attributes
2 don't cause an error. */
4 /* { dg-do compile } */
5 /* { dg-options "-O1 -ffinite-math-only" } */
7 /* -O1 in the options is significant. Without it FP operations may not be
8 optimized to custom instructions. */
10 #include <stdio.h>
11 #include <math.h>
13 /* This test case is expected to cause an error because GCC does not know
14 how to merge different custom instruction attribute sets, even if they
15 do not overlap. */
17 extern void
18 custom_fp (float operand_a, float operand_b, float *result)
19 __attribute__ ((target ("custom-fmaxs=246,custom-fmins=247")));
21 extern void
22 custom_fp (float operand_a, float operand_b, float *result)
23 __attribute__ ((target ("custom-fmaxs=246,custom-fmins=247")));
25 void
26 custom_fp (float operand_a, float operand_b, float *result)
28 result[0] = fmaxf (operand_a, operand_b);
29 result[1] = fminf (operand_a, operand_b);
32 /* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
33 /* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */