blob: 6f302b1335b6f2b9cf00237a6d412aeb1455961d [file] [log] [blame]
Pekka Jaaskelainen37014502014-12-10 16:41:14 +00001// 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
Pekka Jaaskelainen37014502014-12-10 16:41:14 +00005
6typedef __attribute__(( ext_vector_type(4) )) float float4;
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 float
Pekka Jaaskelainen37014502014-12-10 16:41:14 +000015 return a / b;
16}
17// CHECK: attributes
18
19// NORMAL: "no-infs-fp-math"="false"
20// NORMAL: "no-nans-fp-math"="false"
21// NORMAL: "unsafe-fp-math"="false"
22
23// FAST: "no-infs-fp-math"="true"
24// FAST: "no-nans-fp-math"="true"
25// FAST: "unsafe-fp-math"="true"
26
27// FINITE: "no-infs-fp-math"="true"
28// FINITE: "no-nans-fp-math"="true"
29// FINITE: "unsafe-fp-math"="false"
30
31// UNSAFE: "no-infs-fp-math"="false"
32// UNSAFE: "no-nans-fp-math"="true"
33// UNSAFE: "unsafe-fp-math"="true"
34