1 ; Check that we can enable/disable UnsafeFPMath via function attributes. An
2 ; attribute on one function should not magically apply to the next one.
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown \
5 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=SAFE
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -enable-unsafe-fp-math \
8 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=UNSAFE
10 ; The div in these functions should be converted to a mul when unsafe-fp-math
13 ; CHECK-LABEL: unsafe_fp_math_default0:
14 define double @unsafe_fp_math_default0(double %x) {
17 %div = fdiv double %x, 2.0
21 ; CHECK-LABEL: unsafe_fp_math_off:
22 define double @unsafe_fp_math_off(double %x) #0 {
25 %div = fdiv double %x, 2.0
29 ; CHECK-LABEL: unsafe_fp_math_default1:
30 define double @unsafe_fp_math_default1(double %x) {
31 ; With unsafe math enabled, can change this div to a mul.
34 %div = fdiv double %x, 2.0
38 ; CHECK-LABEL: unsafe_fp_math_on:
39 define double @unsafe_fp_math_on(double %x) #1 {
42 %div = fdiv double %x, 2.0
46 ; CHECK-LABEL: unsafe_fp_math_default2:
47 define double @unsafe_fp_math_default2(double %x) {
48 ; With unsafe math enabled, can change this div to a mul.
51 %div = fdiv double %x, 2.0
55 attributes #0 = { "unsafe-fp-math"="false" }
56 attributes #1 = { "unsafe-fp-math"="true" }