(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
nios2/
custom-fp-4.c
       1  /* Test conflict between pragma and attribute specification of custom
       2     instructions.  */
       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.  The extern
      15     declaration sees the options specified by both the pragma and the function
      16     attribute, but the function definition sees only the pragma options.  */
      17  
      18  #pragma GCC target ("custom-fmaxs=246")
      19  
      20  extern void
      21  custom_fp (float operand_a, float operand_b, float *result)
      22    __attribute__ ((target ("custom-fmins=247")));
      23  
      24  void
      25  custom_fp (float operand_a, float operand_b, float *result)
      26  {   /* { dg-error "conflicting" } */
      27    result[0] = fmaxf (operand_a, operand_b);
      28    result[1] = fminf (operand_a, operand_b);
      29  }