1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
// RUN: %clang_cc1 -O3 -ffp-contract=fast-honor-pragmas -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
float fp_contract_on_1(float a, float b, float c) {
// CHECK-LABEL: fp_contract_on_1fff(
// CHECK: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
#pragma STDC FP_CONTRACT ON
return a * b + c;
}
float fp_contract_on_2(float a, float b, float c) {
// CHECK-LABEL: fp_contract_on_2fff(
// CHECK: fmul float
// CHECK: fadd float
#pragma STDC FP_CONTRACT ON
float t = a * b;
return t + c;
}
float fp_contract_off_1(float a, float b, float c) {
// CHECK-LABEL: fp_contract_off_1fff(
// CHECK: fmul float
// CHECK: fadd float
#pragma STDC FP_CONTRACT OFF
return a * b + c;
}
float fp_contract_off_2(float a, float b, float c) {
// CHECK-LABEL: fp_contract_off_2fff(
// CHECK: fmul float
// CHECK: fadd float
#pragma STDC FP_CONTRACT OFF
float t = a * b;
return t + c;
}
float fp_contract_default_1(float a, float b, float c) {
// CHECK-LABEL: fp_contract_default_1fff(
// CHECK: fmul contract float
// CHECK: fadd contract float
#pragma STDC FP_CONTRACT DEFAULT
return a * b + c;
}
float fp_contract_default_2(float a, float b, float c) {
// CHECK-LABEL: fp_contract_default_2fff(
// CHECK: fmul contract float
// CHECK: fadd contract float
#pragma STDC FP_CONTRACT DEFAULT
float t = a * b;
return t + c;
}
float fp_contract_clang_on_1(float a, float b, float c) {
// CHECK-LABEL: fp_contract_clang_on_1fff(
// CHECK: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
#pragma clang fp contract(on)
return a * b + c;
}
float fp_contract_clang_on_2(float a, float b, float c) {
// CHECK-LABEL: fp_contract_clang_on_2fff(
// CHECK: fmul float
// CHECK: fadd float
#pragma clang fp contract(on)
float t = a * b;
return t + c;
}
float fp_contract_clang_off_1(float a, float b, float c) {
// CHECK-LABEL: fp_contract_clang_off_1fff(
// CHECK: fmul float
// CHECK: fadd float
#pragma clang fp contract(off)
return a * b + c;
}
float fp_contract_clang_off_2(float a, float b, float c) {
// CHECK-LABEL: fp_contract_clang_off_2fff(
// CHECK: fmul float
// CHECK: fadd float
#pragma clang fp contract(off)
float t = a * b;
return t + c;
}
float fp_contract_clang_fast_1(float a, float b, float c) {
// CHECK-LABEL: fp_contract_clang_fast_1fff(
// CHECK: fmul contract float
// CHECK: fadd contract float
#pragma clang fp contract(fast)
return a * b + c;
}
float fp_contract_clang_fast_2(float a, float b, float c) {
// CHECK-LABEL: fp_contract_clang_fast_2fff(
// CHECK: fmul contract float
// CHECK: fadd contract float
#pragma clang fp contract(fast)
float t = a * b;
return t + c;
}
#pragma STDC FP_CONTRACT ON
float fp_contract_global_on_1(float a, float b, float c) {
// CHECK-LABEL: fp_contract_global_on_1fff(
// CHECK: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
return a * b + c;
}
float fp_contract_global_on_2(float a, float b, float c) {
// CHECK-LABEL: fp_contract_global_on_2fff(
// CHECK: fmul float
// CHECK: fadd float
float t = a * b;
return t + c;
}
#pragma STDC FP_CONTRACT OFF
float fp_contract_global_off_1(float a, float b, float c) {
// CHECK-LABEL: fp_contract_global_off_1fff(
// CHECK: fmul float
// CHECK: fadd float
return a * b + c;
}
float fp_contract_global_off_2(float a, float b, float c) {
// CHECK-LABEL: fp_contract_global_off_2fff(
// CHECK: fmul float
// CHECK: fadd float
float t = a * b;
return t + c;
}
#pragma STDC FP_CONTRACT DEFAULT
float fp_contract_global_default_1(float a, float b, float c) {
// CHECK-LABEL: fp_contract_global_default_1fff(
// CHECK: fmul contract float
// CHECK: fadd contract float
return a * b + c;
}
float fp_contract_global_default_2(float a, float b, float c) {
// CHECK-LABEL: fp_contract_global_default_2fff(
// CHECK: fmul contract float
// CHECK: fadd contract float
float t = a * b;
return t + c;
}
|