71 lines · plain
1; Check that we can enable/disable UnsafeFPMath via function attributes. An2; attribute on one function should not magically apply to the next one.3 4; RUN: llc < %s -mtriple=x86_64-unknown-unknown \5; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=SAFE6 7; RUN: llc < %s -mtriple=x86_64-unknown-unknown \8; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=UNSAFE9 10; The div in these functions should be converted to a mul when unsafe-fp-math11; is enabled.12 13; CHECK-LABEL: unsafe_fp_math_default0:14define double @unsafe_fp_math_default0(double %x) {15; UNSAFE: mulsd16 %div = fdiv arcp double %x, 3.017 ret double %div18}19; CHECK-LABEL: safe_fp_math_default0:20define double @safe_fp_math_default0(double %x) {21; SAFE: divsd22 %div = fdiv double %x, 3.023 ret double %div24}25 26; CHECK-LABEL: unsafe_fp_math_off:27define double @unsafe_fp_math_off(double %x) {28; SAFE: divsd29; UNSAFE: divsd30 %div = fdiv double %x, 3.031 ret double %div32}33 34; CHECK-LABEL: unsafe_fp_math_default1:35define double @unsafe_fp_math_default1(double %x) {36; With unsafe math enabled, can change this div to a mul.37; UNSAFE: mulsd38 %div = fdiv arcp double %x, 3.039 ret double %div40}41; CHECK-LABEL: safe_fp_math_default1:42define double @safe_fp_math_default1(double %x) {43; With unsafe math enabled, can change this div to a mul.44; SAFE: divsd45 %div = fdiv double %x, 3.046 ret double %div47}48 49; CHECK-LABEL: unsafe_fp_math_on:50define double @unsafe_fp_math_on(double %x) {51; SAFE: mulsd52; UNSAFE: mulsd53 %div = fdiv arcp double %x, 3.054 ret double %div55}56 57; CHECK-LABEL: unsafe_fp_math_default2:58define double @unsafe_fp_math_default2(double %x) {59; With unsafe math enabled, can change this div to a mul.60; UNSAFE: mulsd61 %div = fdiv arcp double %x, 3.062 ret double %div63}64; CHECK-LABEL: safe_fp_math_default2:65define double @safe_fp_math_default2(double %x) {66; With unsafe math enabled, can change this div to a mul.67; SAFE: divsd68 %div = fdiv double %x, 3.069 ret double %div70}71