Rafael Espindola | ae6000e | 2013-08-23 20:39:19 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+sse4.1 | FileCheck -check-prefix=CHECK-SSE %s |
Bob Wilson | 4c65c50 | 2012-08-08 20:31:37 +0000 | [diff] [blame] | 2 | ; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+avx | FileCheck -check-prefix=CHECK-AVX %s |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 3 | |
| 4 | define float @test1(float %x) nounwind { |
| 5 | %call = tail call float @floorf(float %x) nounwind readnone |
| 6 | ret float %call |
| 7 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 8 | ; CHECK-SSE-LABEL: test1: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 9 | ; CHECK-SSE: roundss $1 |
| 10 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 11 | ; CHECK-AVX-LABEL: test1: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 12 | ; CHECK-AVX: vroundss $1 |
| 13 | } |
| 14 | |
| 15 | declare float @floorf(float) nounwind readnone |
| 16 | |
| 17 | define double @test2(double %x) nounwind { |
| 18 | %call = tail call double @floor(double %x) nounwind readnone |
| 19 | ret double %call |
| 20 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 21 | ; CHECK-SSE-LABEL: test2: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 22 | ; CHECK-SSE: roundsd $1 |
| 23 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 24 | ; CHECK-AVX-LABEL: test2: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 25 | ; CHECK-AVX: vroundsd $1 |
| 26 | } |
| 27 | |
| 28 | declare double @floor(double) nounwind readnone |
| 29 | |
| 30 | define float @test3(float %x) nounwind { |
| 31 | %call = tail call float @nearbyintf(float %x) nounwind readnone |
| 32 | ret float %call |
| 33 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 34 | ; CHECK-SSE-LABEL: test3: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 35 | ; CHECK-SSE: roundss $12 |
| 36 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 37 | ; CHECK-AVX-LABEL: test3: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 38 | ; CHECK-AVX: vroundss $12 |
| 39 | } |
| 40 | |
| 41 | declare float @nearbyintf(float) nounwind readnone |
| 42 | |
| 43 | define double @test4(double %x) nounwind { |
| 44 | %call = tail call double @nearbyint(double %x) nounwind readnone |
| 45 | ret double %call |
| 46 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 47 | ; CHECK-SSE-LABEL: test4: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 48 | ; CHECK-SSE: roundsd $12 |
| 49 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 50 | ; CHECK-AVX-LABEL: test4: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 51 | ; CHECK-AVX: vroundsd $12 |
| 52 | } |
| 53 | |
| 54 | declare double @nearbyint(double) nounwind readnone |
| 55 | |
| 56 | define float @test5(float %x) nounwind { |
| 57 | %call = tail call float @ceilf(float %x) nounwind readnone |
| 58 | ret float %call |
| 59 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 60 | ; CHECK-SSE-LABEL: test5: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 61 | ; CHECK-SSE: roundss $2 |
| 62 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 63 | ; CHECK-AVX-LABEL: test5: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 64 | ; CHECK-AVX: vroundss $2 |
| 65 | } |
| 66 | |
| 67 | declare float @ceilf(float) nounwind readnone |
| 68 | |
| 69 | define double @test6(double %x) nounwind { |
| 70 | %call = tail call double @ceil(double %x) nounwind readnone |
| 71 | ret double %call |
| 72 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 73 | ; CHECK-SSE-LABEL: test6: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 74 | ; CHECK-SSE: roundsd $2 |
| 75 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 76 | ; CHECK-AVX-LABEL: test6: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 77 | ; CHECK-AVX: vroundsd $2 |
| 78 | } |
| 79 | |
| 80 | declare double @ceil(double) nounwind readnone |
| 81 | |
| 82 | define float @test7(float %x) nounwind { |
| 83 | %call = tail call float @rintf(float %x) nounwind readnone |
| 84 | ret float %call |
| 85 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 86 | ; CHECK-SSE-LABEL: test7: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 87 | ; CHECK-SSE: roundss $4 |
| 88 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 89 | ; CHECK-AVX-LABEL: test7: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 90 | ; CHECK-AVX: vroundss $4 |
| 91 | } |
| 92 | |
| 93 | declare float @rintf(float) nounwind readnone |
| 94 | |
| 95 | define double @test8(double %x) nounwind { |
| 96 | %call = tail call double @rint(double %x) nounwind readnone |
| 97 | ret double %call |
| 98 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 99 | ; CHECK-SSE-LABEL: test8: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 100 | ; CHECK-SSE: roundsd $4 |
| 101 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 102 | ; CHECK-AVX-LABEL: test8: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 103 | ; CHECK-AVX: vroundsd $4 |
| 104 | } |
| 105 | |
| 106 | declare double @rint(double) nounwind readnone |
| 107 | |
| 108 | define float @test9(float %x) nounwind { |
| 109 | %call = tail call float @truncf(float %x) nounwind readnone |
| 110 | ret float %call |
| 111 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 112 | ; CHECK-SSE-LABEL: test9: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 113 | ; CHECK-SSE: roundss $3 |
| 114 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 115 | ; CHECK-AVX-LABEL: test9: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 116 | ; CHECK-AVX: vroundss $3 |
| 117 | } |
| 118 | |
| 119 | declare float @truncf(float) nounwind readnone |
| 120 | |
| 121 | define double @test10(double %x) nounwind { |
| 122 | %call = tail call double @trunc(double %x) nounwind readnone |
| 123 | ret double %call |
| 124 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 125 | ; CHECK-SSE-LABEL: test10: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 126 | ; CHECK-SSE: roundsd $3 |
| 127 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 128 | ; CHECK-AVX-LABEL: test10: |
Benjamin Kramer | 16bbfbe | 2011-12-09 15:44:03 +0000 | [diff] [blame] | 129 | ; CHECK-AVX: vroundsd $3 |
| 130 | } |
| 131 | |
| 132 | declare double @trunc(double) nounwind readnone |