aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/abs-3.c
blob: d2638e8f4c5f03047e8ac5ee527e3e51c7ecccd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
/* PR tree-optimization/109829 */

float abs_f(float x) { return __builtin_signbit(x) ? -x : x; }
double abs_d(double x) { return __builtin_signbit(x) ? -x : x; }
long double abs_ld(long double x) { return __builtin_signbit(x) ? -x : x; }


/* __builtin_signbit(x) ? -x : x. Should be convert into ABS_EXP<x> */
/* { dg-final { scan-tree-dump-not "signbit" "optimized"} } */
/* { dg-final { scan-tree-dump-not "= -" "optimized"} } */
/* { dg-final { scan-tree-dump-times "= ABS_EXPR" 3 "optimized"} } */