Clang Project

clang_source_code/test/CodeGenOpenCL/relaxed-fpmath.cl
1// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s -check-prefix=NORMAL
2// RUN: %clang_cc1 %s -emit-llvm -cl-fast-relaxed-math -o - | FileCheck %s -check-prefix=FAST
3// RUN: %clang_cc1 %s -emit-llvm -cl-finite-math-only -o - | FileCheck %s -check-prefix=FINITE
4// RUN: %clang_cc1 %s -emit-llvm -cl-unsafe-math-optimizations -o - | FileCheck %s -check-prefix=UNSAFE
5// RUN: %clang_cc1 %s -emit-llvm -cl-mad-enable -o - | FileCheck %s -check-prefix=MAD
6// RUN: %clang_cc1 %s -emit-llvm -cl-no-signed-zeros -o - | FileCheck %s -check-prefix=NOSIGNED
7
8float spscalardiv(float a, float b) {
9  // CHECK: @spscalardiv(
10
11  // NORMAL: fdiv float
12  // FAST: fdiv fast float
13  // FINITE: fdiv nnan ninf float
14  // UNSAFE: fdiv nnan nsz float
15  // MAD: fdiv float
16  // NOSIGNED: fdiv nsz float
17  return a / b;
18}
19// CHECK: attributes
20
21// NORMAL: "less-precise-fpmad"="false"
22// NORMAL: "no-infs-fp-math"="false"
23// NORMAL: "no-nans-fp-math"="false"
24// NORMAL: "no-signed-zeros-fp-math"="false"
25// NORMAL: "unsafe-fp-math"="false"
26
27// FAST: "less-precise-fpmad"="true"
28// FAST: "no-infs-fp-math"="true"
29// FAST: "no-nans-fp-math"="true"
30// FAST: "no-signed-zeros-fp-math"="true"
31// FAST: "unsafe-fp-math"="true"
32
33// FINITE: "less-precise-fpmad"="false"
34// FINITE: "no-infs-fp-math"="true"
35// FINITE: "no-nans-fp-math"="true"
36// FINITE: "no-signed-zeros-fp-math"="false"
37// FINITE: "unsafe-fp-math"="false"
38
39// UNSAFE: "less-precise-fpmad"="true"
40// UNSAFE: "no-infs-fp-math"="false"
41// UNSAFE: "no-nans-fp-math"="true"
42// UNSAFE: "no-signed-zeros-fp-math"="true"
43// UNSAFE: "unsafe-fp-math"="true"
44
45// MAD: "less-precise-fpmad"="true"
46// MAD: "no-infs-fp-math"="false"
47// MAD: "no-nans-fp-math"="false"
48// MAD: "no-signed-zeros-fp-math"="false"
49// MAD: "unsafe-fp-math"="false"
50
51// NOSIGNED: "less-precise-fpmad"="false"
52// NOSIGNED: "no-infs-fp-math"="false"
53// NOSIGNED: "no-nans-fp-math"="false"
54// NOSIGNED: "no-signed-zeros-fp-math"="true"
55// NOSIGNED: "unsafe-fp-math"="false"
56