File: saturate.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (62 lines) | stat: -rw-r--r-- 2,283 bytes parent folder | download | duplicates (3)
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
; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
; Make sure the intrinsic dx.saturate is to appropriate DXIL op for half/float/double data types.

; CHECK-LABEL: test_saturate_half
define noundef half @test_saturate_half(half noundef %p0) {
entry:
  ; CHECK: call half @dx.op.unary.f16(i32 7, half %p0) #[[#ATTR:]]
  %hlsl.saturate = call half @llvm.dx.saturate.f16(half %p0)
  ; CHECK: ret half
  ret half %hlsl.saturate
}

; CHECK-LABEL: test_saturate_float
define noundef float @test_saturate_float(float noundef %p0) {
entry:
  ; CHECK: call float @dx.op.unary.f32(i32 7, float %p0) #[[#ATTR]]
  %hlsl.saturate = call float @llvm.dx.saturate.f32(float %p0)
  ; CHECK: ret float
  ret float %hlsl.saturate
}

; CHECK-LABEL: test_saturate_double
define noundef double @test_saturate_double(double noundef %p0) {
entry:
  ; CHECK: call double @dx.op.unary.f64(i32 7, double %p0) #[[#ATTR]]
  %hlsl.saturate = call double @llvm.dx.saturate.f64(double %p0)
  ; CHECK: ret double
  ret double %hlsl.saturate
}

; CHECK-LABEL: test_saturate_half4
define noundef <4 x half> @test_saturate_half4(<4 x half> noundef %p0) {
entry:
  ; CHECK: call half @dx.op.unary.f16(i32 7, half
  ; CHECK: call half @dx.op.unary.f16(i32 7, half
  ; CHECK: call half @dx.op.unary.f16(i32 7, half
  ; CHECK: call half @dx.op.unary.f16(i32 7, half
  %hlsl.saturate = call <4 x half> @llvm.dx.saturate.v4f16(<4 x half> %p0)
  ret <4 x half> %hlsl.saturate
}

; CHECK-LABEL: test_saturate_float3
define noundef <3 x float> @test_saturate_float3(<3 x float> noundef %p0) {
entry:
  ; CHECK: call float @dx.op.unary.f32(i32 7, float
  ; CHECK: call float @dx.op.unary.f32(i32 7, float
  ; CHECK: call float @dx.op.unary.f32(i32 7, float
  %hlsl.saturate = call <3 x float> @llvm.dx.saturate.v3f32(<3 x float> %p0)
  ret <3 x float> %hlsl.saturate
}

; CHECK-LABEL: test_saturate_double2
define noundef <2 x double> @test_saturate_double2(<2 x double> noundef %p0) {
entry:
  ; CHECK: call double @dx.op.unary.f64(i32 7, double
  ; CHECK: call double @dx.op.unary.f64(i32 7, double
  %hlsl.saturate = call <2 x double> @llvm.dx.saturate.v4f64(<2 x double> %p0)
  ret <2 x double> %hlsl.saturate
}


; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}