1 /* Test that duplicate declarations with the same custom insn attributes
2    don't cause an error.  */
3 
4 /* { dg-do compile } */
5 /* { dg-options "-O1 -ffinite-math-only" } */
6 
7 /* -O1 in the options is significant.  Without it FP operations may not be
8    optimized to custom instructions.  */
9 
10 #include <stdio.h>
11 #include <math.h>
12 
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.  */
16 
17 extern void
18 custom_fp (float operand_a, float operand_b, float *result)
19   __attribute__ ((target ("custom-fmaxs=246,custom-fmins=247")));
20 
21 extern void
22 custom_fp (float operand_a, float operand_b, float *result)
23   __attribute__ ((target ("custom-fmaxs=246,custom-fmins=247")));
24 
25 void
custom_fp(float operand_a,float operand_b,float * result)26 custom_fp (float operand_a, float operand_b, float *result)
27 {
28   result[0] = fmaxf (operand_a, operand_b);
29   result[1] = fminf (operand_a, operand_b);
30 }
31 
32 /* { dg-final { scan-assembler "custom\\t246, .* # fmaxs .*" } } */
33 /* { dg-final { scan-assembler "custom\\t247, .* # fmins .*" } } */
34