|
| 1 | +// DirectX target: |
| 2 | +// |
| 3 | +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 4 | +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ |
| 5 | +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ |
| 6 | +// RUN: --check-prefixes=DX-CHECK,DX-NATIVE_HALF |
| 7 | + |
| 8 | +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 9 | +// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ |
| 10 | +// RUN: -o - | FileCheck %s --check-prefixes=DX-CHECK,DX-NO_HALF |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +// Spirv target: |
| 15 | +// |
| 16 | +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 17 | +// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ |
| 18 | +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ |
| 19 | +// RUN: --check-prefixes=SPV-CHECK,SPV-NATIVE_HALF |
| 20 | + |
| 21 | +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
| 22 | +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ |
| 23 | +// RUN: -o - | FileCheck %s --check-prefixes=SPV-CHECK,SPV-NO_HALF |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +// DX-NATIVE_HALF: define noundef half @ |
| 28 | +// DX-NATIVE_HALF: %dx.fmod = call half @llvm.dx.fmod.f16( |
| 29 | +// DX-NATIVE_HALF: ret half %dx.fmod |
| 30 | +// DX-NO_HALF: define noundef float @ |
| 31 | +// DX-NO_HALF: %dx.fmod = call float @llvm.dx.fmod.f32( |
| 32 | +// DX-NO_HALF: ret float %dx.fmod |
| 33 | +// |
| 34 | +// SPV-NATIVE_HALF: define spir_func noundef half @ |
| 35 | +// SPV-NATIVE_HALF: %fmod = frem half |
| 36 | +// SPV-NATIVE_HALF: ret half %fmod |
| 37 | +// SPV-NO_HALF: define spir_func noundef float @ |
| 38 | +// SPV-NO_HALF: %fmod = frem float |
| 39 | +// SPV-NO_HALF: ret float %fmod |
| 40 | +half test_fmod_half(half p0, half p1) { return fmod(p0, p1); } |
| 41 | + |
| 42 | +// DX-NATIVE_HALF: define noundef <2 x half> @ |
| 43 | +// DX-NATIVE_HALF: %dx.fmod = call <2 x half> @llvm.dx.fmod.v2f16 |
| 44 | +// DX-NATIVE_HALF: ret <2 x half> %dx.fmod |
| 45 | +// DX-NO_HALF: define noundef <2 x float> @ |
| 46 | +// DX-NO_HALF: %dx.fmod = call <2 x float> @llvm.dx.fmod.v2f32( |
| 47 | +// DX-NO_HALF: ret <2 x float> %dx.fmod |
| 48 | +// |
| 49 | +// SPV-NATIVE_HALF: define spir_func noundef <2 x half> @ |
| 50 | +// SPV-NATIVE_HALF: %fmod = frem <2 x half> |
| 51 | +// SPV-NATIVE_HALF: ret <2 x half> %fmod |
| 52 | +// SPV-NO_HALF: define spir_func noundef <2 x float> @ |
| 53 | +// SPV-NO_HALF: %fmod = frem <2 x float> |
| 54 | +// SPV-NO_HALF: ret <2 x float> %fmod |
| 55 | +half2 test_fmod_half2(half2 p0, half2 p1) { return fmod(p0, p1); } |
| 56 | + |
| 57 | +// DX-NATIVE_HALF: define noundef <3 x half> @ |
| 58 | +// DX-NATIVE_HALF: %dx.fmod = call <3 x half> @llvm.dx.fmod.v3f16 |
| 59 | +// DX-NATIVE_HALF: ret <3 x half> %dx.fmod |
| 60 | +// DX-NO_HALF: define noundef <3 x float> @ |
| 61 | +// DX-NO_HALF: %dx.fmod = call <3 x float> @llvm.dx.fmod.v3f32( |
| 62 | +// DX-NO_HALF: ret <3 x float> %dx.fmod |
| 63 | +// |
| 64 | +// SPV-NATIVE_HALF: define spir_func noundef <3 x half> @ |
| 65 | +// SPV-NATIVE_HALF: %fmod = frem <3 x half> |
| 66 | +// SPV-NATIVE_HALF: ret <3 x half> %fmod |
| 67 | +// SPV-NO_HALF: define spir_func noundef <3 x float> @ |
| 68 | +// SPV-NO_HALF: %fmod = frem <3 x float> |
| 69 | +// SPV-NO_HALF: ret <3 x float> %fmod |
| 70 | +half3 test_fmod_half3(half3 p0, half3 p1) { return fmod(p0, p1); } |
| 71 | + |
| 72 | +// DX-NATIVE_HALF: define noundef <4 x half> @ |
| 73 | +// DX-NATIVE_HALF: %dx.fmod = call <4 x half> @llvm.dx.fmod.v4f16 |
| 74 | +// DX-NATIVE_HALF: ret <4 x half> %dx.fmod |
| 75 | +// DX-NO_HALF: define noundef <4 x float> @ |
| 76 | +// DX-NO_HALF: %dx.fmod = call <4 x float> @llvm.dx.fmod.v4f32( |
| 77 | +// DX-NO_HALF: ret <4 x float> %dx.fmod |
| 78 | +// |
| 79 | +// SPV-NATIVE_HALF: define spir_func noundef <4 x half> @ |
| 80 | +// SPV-NATIVE_HALF: %fmod = frem <4 x half> |
| 81 | +// SPV-NATIVE_HALF: ret <4 x half> %fmod |
| 82 | +// SPV-NO_HALF: define spir_func noundef <4 x float> @ |
| 83 | +// SPV-NO_HALF: %fmod = frem <4 x float> |
| 84 | +// SPV-NO_HALF: ret <4 x float> %fmod |
| 85 | +half4 test_fmod_half4(half4 p0, half4 p1) { return fmod(p0, p1); } |
| 86 | + |
| 87 | +// DX-CHECK: define noundef float @ |
| 88 | +// DX-CHECK: %dx.fmod = call float @llvm.dx.fmod.f32( |
| 89 | +// DX-CHECK: ret float %dx.fmod |
| 90 | +// |
| 91 | +// SPV-CHECK: define spir_func noundef float @ |
| 92 | +// SPV-CHECK: %fmod = frem float |
| 93 | +// SPV-CHECK: ret float %fmod |
| 94 | +float test_fmod_float(float p0, float p1) { return fmod(p0, p1); } |
| 95 | + |
| 96 | +// DX-CHECK: define noundef <2 x float> @ |
| 97 | +// DX-CHECK: %dx.fmod = call <2 x float> @llvm.dx.fmod.v2f32 |
| 98 | +// DX-CHECK: ret <2 x float> %dx.fmod |
| 99 | +// |
| 100 | +// SPV-CHECK: define spir_func noundef <2 x float> @ |
| 101 | +// SPV-CHECK: %fmod = frem <2 x float> |
| 102 | +// SPV-CHECK: ret <2 x float> %fmod |
| 103 | +float2 test_fmod_float2(float2 p0, float2 p1) { return fmod(p0, p1); } |
| 104 | + |
| 105 | +// DX-CHECK: define noundef <3 x float> @ |
| 106 | +// DX-CHECK: %dx.fmod = call <3 x float> @llvm.dx.fmod.v3f32 |
| 107 | +// DX-CHECK: ret <3 x float> %dx.fmod |
| 108 | +// |
| 109 | +// SPV-CHECK: define spir_func noundef <3 x float> @ |
| 110 | +// SPV-CHECK: %fmod = frem <3 x float> |
| 111 | +// SPV-CHECK: ret <3 x float> %fmod |
| 112 | +float3 test_fmod_float3(float3 p0, float3 p1) { return fmod(p0, p1); } |
| 113 | + |
| 114 | +// DX-CHECK: define noundef <4 x float> @ |
| 115 | +// DX-CHECK: %dx.fmod = call <4 x float> @llvm.dx.fmod.v4f32 |
| 116 | +// DX-CHECK: ret <4 x float> %dx.fmod |
| 117 | +// |
| 118 | +// SPV-CHECK: define spir_func noundef <4 x float> @ |
| 119 | +// SPV-CHECK: %fmod = frem <4 x float> |
| 120 | +// SPV-CHECK: ret <4 x float> %fmod |
| 121 | +float4 test_fmod_float4(float4 p0, float4 p1) { return fmod(p0, p1); } |
| 122 | + |
0 commit comments