|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s |
| 3 | + |
| 4 | +declare half @llvm.dx.radians.f16(half) |
| 5 | +declare float @llvm.dx.radians.f32(float) |
| 6 | +declare double @llvm.dx.radians.f64(double) |
| 7 | + |
| 8 | +declare <4 x half> @llvm.dx.radians.v4f16(<4 x half>) |
| 9 | +declare <4 x float> @llvm.dx.radians.v4f32(<4 x float>) |
| 10 | +declare <4 x double> @llvm.dx.radians.v4f64(<4 x double>) |
| 11 | + |
| 12 | +define noundef half @radians_half(half noundef %a) { |
| 13 | +; CHECK-LABEL: define noundef half @radians_half( |
| 14 | +; CHECK-SAME: half noundef [[A:%.*]]) { |
| 15 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 16 | +; CHECK-NEXT: [[TMP0:%.*]] = fmul half [[A]], 0xH2478 |
| 17 | +; CHECK-NEXT: ret half [[TMP0]] |
| 18 | +; |
| 19 | +entry: |
| 20 | + %elt.radians = call half @llvm.dx.radians.f16(half %a) |
| 21 | + ret half %elt.radians |
| 22 | +} |
| 23 | + |
| 24 | +define noundef float @radians_float(float noundef %a) { |
| 25 | +; CHECK-LABEL: define noundef float @radians_float( |
| 26 | +; CHECK-SAME: float noundef [[A:%.*]]) { |
| 27 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 28 | +; CHECK-NEXT: [[TMP0:%.*]] = fmul float [[A]], 0x3F91DF46A0000000 |
| 29 | +; CHECK-NEXT: ret float [[TMP0]] |
| 30 | +; |
| 31 | +entry: |
| 32 | + %elt.radians = call float @llvm.dx.radians.f32(float %a) |
| 33 | + ret float %elt.radians |
| 34 | +} |
| 35 | + |
| 36 | +define noundef double @radians_double(double noundef %a) { |
| 37 | +; CHECK-LABEL: define noundef double @radians_double( |
| 38 | +; CHECK-SAME: double noundef [[A:%.*]]) { |
| 39 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 40 | +; CHECK-NEXT: [[TMP0:%.*]] = fmul double [[A]], 0x3F91DF46A2529D39 |
| 41 | +; CHECK-NEXT: ret double [[TMP0]] |
| 42 | +; |
| 43 | +entry: |
| 44 | + %elt.radians = call double @llvm.dx.radians.f64(double %a) |
| 45 | + ret double %elt.radians |
| 46 | +} |
| 47 | + |
| 48 | +define noundef <4 x half> @radians_half_vector(<4 x half> noundef %a) { |
| 49 | +; CHECK-LABEL: define noundef <4 x half> @radians_half_vector( |
| 50 | +; CHECK-SAME: <4 x half> noundef [[A:%.*]]) { |
| 51 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 52 | +; CHECK-NEXT: [[TMP0:%.*]] = fmul <4 x half> [[A]], <half 0xH2478, half 0xH2478, half 0xH2478, half 0xH2478> |
| 53 | +; CHECK-NEXT: ret <4 x half> [[TMP0]] |
| 54 | +; |
| 55 | +entry: |
| 56 | + %elt.radians = call <4 x half> @llvm.dx.radians.v4f16(<4 x half> %a) |
| 57 | + ret <4 x half> %elt.radians |
| 58 | +} |
| 59 | + |
| 60 | +define noundef <4 x float> @radians_float_vector(<4 x float> noundef %a) { |
| 61 | +; CHECK-LABEL: define noundef <4 x float> @radians_float_vector( |
| 62 | +; CHECK-SAME: <4 x float> noundef [[A:%.*]]) { |
| 63 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 64 | +; CHECK-NEXT: [[TMP0:%.*]] = fmul <4 x float> [[A]], <float 0x3F91DF46A0000000, float 0x3F91DF46A0000000, float 0x3F91DF46A0000000, float 0x3F91DF46A0000000> |
| 65 | +; CHECK-NEXT: ret <4 x float> [[TMP0]] |
| 66 | +; |
| 67 | +entry: |
| 68 | + %elt.radians = call <4 x float> @llvm.dx.radians.v4f32(<4 x float> %a) |
| 69 | + ret <4 x float> %elt.radians |
| 70 | +} |
| 71 | + |
| 72 | +define noundef <4 x double> @radians_double_vector(<4 x double> noundef %a) { |
| 73 | +; CHECK-LABEL: define noundef <4 x double> @radians_double_vector( |
| 74 | +; CHECK-SAME: <4 x double> noundef [[A:%.*]]) { |
| 75 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 76 | +; CHECK-NEXT: [[TMP0:%.*]] = fmul <4 x double> [[A]], <double 0x3F91DF46A2529D39, double 0x3F91DF46A2529D39, double 0x3F91DF46A2529D39, double 0x3F91DF46A2529D39> |
| 77 | +; CHECK-NEXT: ret <4 x double> [[TMP0]] |
| 78 | +; |
| 79 | +entry: |
| 80 | + %elt.radians = call <4 x double> @llvm.dx.radians.v4f64(<4 x double> %a) |
| 81 | + ret <4 x double> %elt.radians |
| 82 | +} |
0 commit comments