Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 1 | ; RUN: llc -O3 < %s -mtriple=arm64 | FileCheck %s |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 2 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 3 | ; CHECK-LABEL: test1: |
| 4 | ; CHECK: frintm |
| 5 | ; CHECK-NOT: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 6 | define float @test1(float %a) #0 { |
| 7 | entry: |
| 8 | %call = tail call float @floorf(float %a) nounwind readnone |
| 9 | ret float %call |
| 10 | } |
| 11 | |
| 12 | declare float @floorf(float) nounwind readnone |
| 13 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 14 | ; CHECK-LABEL: test2: |
| 15 | ; CHECK: frintm |
| 16 | ; CHECK-NOT: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 17 | define double @test2(double %a) #0 { |
| 18 | entry: |
| 19 | %call = tail call double @floor(double %a) nounwind readnone |
| 20 | ret double %call |
| 21 | } |
| 22 | |
| 23 | declare double @floor(double) nounwind readnone |
| 24 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 25 | ; CHECK-LABEL: test3: |
| 26 | ; CHECK: frinti |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 27 | define float @test3(float %a) #0 { |
| 28 | entry: |
| 29 | %call = tail call float @nearbyintf(float %a) nounwind readnone |
| 30 | ret float %call |
| 31 | } |
| 32 | |
| 33 | declare float @nearbyintf(float) nounwind readnone |
| 34 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 35 | ; CHECK-LABEL: test4: |
| 36 | ; CHECK: frinti |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 37 | define double @test4(double %a) #0 { |
| 38 | entry: |
| 39 | %call = tail call double @nearbyint(double %a) nounwind readnone |
| 40 | ret double %call |
| 41 | } |
| 42 | |
| 43 | declare double @nearbyint(double) nounwind readnone |
| 44 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 45 | ; CHECK-LABEL: test5: |
| 46 | ; CHECK: frintp |
| 47 | ; CHECK-NOT: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 48 | define float @test5(float %a) #0 { |
| 49 | entry: |
| 50 | %call = tail call float @ceilf(float %a) nounwind readnone |
| 51 | ret float %call |
| 52 | } |
| 53 | |
| 54 | declare float @ceilf(float) nounwind readnone |
| 55 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 56 | ; CHECK-LABEL: test6: |
| 57 | ; CHECK: frintp |
| 58 | ; CHECK-NOT: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 59 | define double @test6(double %a) #0 { |
| 60 | entry: |
| 61 | %call = tail call double @ceil(double %a) nounwind readnone |
| 62 | ret double %call |
| 63 | } |
| 64 | |
| 65 | declare double @ceil(double) nounwind readnone |
| 66 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 67 | ; CHECK-LABEL: test7: |
| 68 | ; CHECK: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 69 | define float @test7(float %a) #0 { |
| 70 | entry: |
| 71 | %call = tail call float @rintf(float %a) nounwind readnone |
| 72 | ret float %call |
| 73 | } |
| 74 | |
| 75 | declare float @rintf(float) nounwind readnone |
| 76 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 77 | ; CHECK-LABEL: test8: |
| 78 | ; CHECK: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 79 | define double @test8(double %a) #0 { |
| 80 | entry: |
| 81 | %call = tail call double @rint(double %a) nounwind readnone |
| 82 | ret double %call |
| 83 | } |
| 84 | |
| 85 | declare double @rint(double) nounwind readnone |
| 86 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 87 | ; CHECK-LABEL: test9: |
| 88 | ; CHECK: frintz |
| 89 | ; CHECK-NOT: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 90 | define float @test9(float %a) #0 { |
| 91 | entry: |
| 92 | %call = tail call float @truncf(float %a) nounwind readnone |
| 93 | ret float %call |
| 94 | } |
| 95 | |
| 96 | declare float @truncf(float) nounwind readnone |
| 97 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 98 | ; CHECK-LABEL: test10: |
| 99 | ; CHECK: frintz |
| 100 | ; CHECK-NOT: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 101 | define double @test10(double %a) #0 { |
| 102 | entry: |
| 103 | %call = tail call double @trunc(double %a) nounwind readnone |
| 104 | ret double %call |
| 105 | } |
| 106 | |
| 107 | declare double @trunc(double) nounwind readnone |
| 108 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 109 | ; CHECK-LABEL: test11: |
| 110 | ; CHECK: frinta |
| 111 | ; CHECK-NOT: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 112 | define float @test11(float %a) #0 { |
| 113 | entry: |
| 114 | %call = tail call float @roundf(float %a) nounwind readnone |
| 115 | ret float %call |
| 116 | } |
| 117 | |
| 118 | declare float @roundf(float %a) nounwind readnone |
| 119 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 120 | ; CHECK-LABEL: test12: |
| 121 | ; CHECK: frinta |
| 122 | ; CHECK-NOT: frintx |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 123 | define double @test12(double %a) #0 { |
| 124 | entry: |
| 125 | %call = tail call double @round(double %a) nounwind readnone |
| 126 | ret double %call |
| 127 | } |
| 128 | |
| 129 | declare double @round(double %a) nounwind readnone |
| 130 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 131 | ; CHECK-LABEL: test13: |
| 132 | ; CHECK-NOT: frintx |
| 133 | ; CHECK: frintm |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 134 | define float @test13(float %a) #1 { |
| 135 | entry: |
| 136 | %call = tail call float @floorf(float %a) nounwind readnone |
| 137 | ret float %call |
| 138 | } |
| 139 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 140 | ; CHECK-LABEL: test14: |
| 141 | ; CHECK-NOT: frintx |
| 142 | ; CHECK: frintm |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 143 | define double @test14(double %a) #1 { |
| 144 | entry: |
| 145 | %call = tail call double @floor(double %a) nounwind readnone |
| 146 | ret double %call |
| 147 | } |
| 148 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 149 | ; CHECK-LABEL: test15: |
| 150 | ; CHECK-NOT: frintx |
| 151 | ; CHECK: frintp |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 152 | define float @test15(float %a) #1 { |
| 153 | entry: |
| 154 | %call = tail call float @ceilf(float %a) nounwind readnone |
| 155 | ret float %call |
| 156 | } |
| 157 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 158 | ; CHECK-LABEL: test16: |
| 159 | ; CHECK-NOT: frintx |
| 160 | ; CHECK: frintp |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 161 | define double @test16(double %a) #1 { |
| 162 | entry: |
| 163 | %call = tail call double @ceil(double %a) nounwind readnone |
| 164 | ret double %call |
| 165 | } |
| 166 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 167 | ; CHECK-LABEL: test17: |
| 168 | ; CHECK-NOT: frintx |
| 169 | ; CHECK: frintz |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 170 | define float @test17(float %a) #1 { |
| 171 | entry: |
| 172 | %call = tail call float @truncf(float %a) nounwind readnone |
| 173 | ret float %call |
| 174 | } |
| 175 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 176 | ; CHECK-LABEL: test18: |
| 177 | ; CHECK-NOT: frintx |
| 178 | ; CHECK: frintz |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 179 | define double @test18(double %a) #1 { |
| 180 | entry: |
| 181 | %call = tail call double @trunc(double %a) nounwind readnone |
| 182 | ret double %call |
| 183 | } |
| 184 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 185 | ; CHECK-LABEL: test19: |
| 186 | ; CHECK-NOT: frintx |
| 187 | ; CHECK: frinta |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 188 | define float @test19(float %a) #1 { |
| 189 | entry: |
| 190 | %call = tail call float @roundf(float %a) nounwind readnone |
| 191 | ret float %call |
| 192 | } |
| 193 | |
Stephen Canon | 8216d88 | 2015-09-22 11:43:17 +0000 | [diff] [blame] | 194 | ; CHECK-LABEL: test20: |
| 195 | ; CHECK-NOT: frintx |
| 196 | ; CHECK: frinta |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 197 | define double @test20(double %a) #1 { |
| 198 | entry: |
| 199 | %call = tail call double @round(double %a) nounwind readnone |
| 200 | ret double %call |
| 201 | } |
| 202 | |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 203 | attributes #0 = { nounwind } |
| 204 | attributes #1 = { nounwind "unsafe-fp-math"="true" } |