Skip to content

Commit 32eed5a

Browse files
committed
Add tests for doubles and int64 vectors
1 parent b5263f7 commit 32eed5a

File tree

3 files changed

+75
-2
lines changed

3 files changed

+75
-2
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
; RUN: opt -S --passes="print-dx-shader-flags" 2>&1 %s | FileCheck %s
2+
; RUN: llc %s --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
3+
4+
target triple = "dxil-pc-shadermodel6.7-library"
5+
6+
; CHECK: ; Combined Shader Flags for Module
7+
; CHECK-NEXT: ; Shader Flags Value: 0x00000014
8+
; CHECK-NEXT: ;
9+
; CHECK-NEXT: ; Note: shader requires additional functionality:
10+
; CHECK-NEXT: ; Double-precision floating point
11+
; CHECK-NEXT: ; Note: extra DXIL module flags:
12+
; CHECK-NEXT: ; Raw and structured buffers
13+
; CHECK-NEXT: ;
14+
; CHECK-NEXT: ; Shader Flags for Module Functions
15+
16+
; CHECK: Function rawbuf : 0x00000014
17+
define void @rawbuf() "hlsl.export" {
18+
%rb = tail call target("dx.RawBuffer", <4 x double>, 0, 0)
19+
@llvm.dx.resource.handlefrombinding.tdx.RawBuffer_v4f16_0_0t(i32 0, i32 0, i32 1, i32 0, i1 false, ptr null)
20+
%load = call { <4 x double>, i1 }
21+
@llvm.dx.resource.load.rawbuffer.v4double.tdx.RawBuffer_v4f16_0_0t(target("dx.RawBuffer", <4 x double>, 0, 0) %rb, i32 0, i32 0)
22+
%extract = extractvalue { <4 x double>, i1 } %load, 0
23+
ret void
24+
}
25+
26+
; Metadata to avoid adding flags not currently of interest to this test
27+
!dx.valver = !{!0}
28+
!0 = !{i32 1, i32 8}
29+
!llvm.module.flags = !{!1}
30+
!1 = !{i32 1, !"dx.resmayalias", i32 1}
31+
32+
; DXC: - Name: SFI0
33+
; DXC-NEXT: Size: 8
34+
; DXC-NEXT: Flags:
35+
; DXC-NEXT: Doubles: true
36+
; DXC: ...
37+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
; RUN: opt -S --passes="print-dx-shader-flags" 2>&1 %s | FileCheck %s
2+
; RUN: llc %s --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
3+
4+
target triple = "dxil-pc-shadermodel6.7-library"
5+
6+
; CHECK: ; Combined Shader Flags for Module
7+
; CHECK-NEXT: ; Shader Flags Value: 0x00100010
8+
; CHECK-NEXT: ;
9+
; CHECK-NEXT: ; Note: shader requires additional functionality:
10+
; CHECK-NEXT: ; 64-Bit integer
11+
; CHECK-NEXT: ; Note: extra DXIL module flags:
12+
; CHECK-NEXT: ; Raw and structured buffers
13+
; CHECK-NEXT: ;
14+
; CHECK-NEXT: ; Shader Flags for Module Functions
15+
16+
; CHECK: Function rawbuf : 0x00100010
17+
define void @rawbuf() "hlsl.export" {
18+
%rb = tail call target("dx.RawBuffer", <4 x i64>, 0, 0)
19+
@llvm.dx.resource.handlefrombinding.tdx.RawBuffer_v4f16_0_0t(i32 0, i32 0, i32 1, i32 0, i1 false, ptr null)
20+
%load = call { <4 x i64>, i1 }
21+
@llvm.dx.resource.load.rawbuffer.v4i64.tdx.RawBuffer_v4f16_0_0t(target("dx.RawBuffer", <4 x i64>, 0, 0) %rb, i32 0, i32 0)
22+
%extract = extractvalue { <4 x i64>, i1 } %load, 0
23+
ret void
24+
}
25+
26+
; Metadata to avoid adding flags not currently of interest to this test
27+
!dx.valver = !{!0}
28+
!0 = !{i32 1, i32 8}
29+
!llvm.module.flags = !{!1}
30+
!1 = !{i32 1, !"dx.resmayalias", i32 1}
31+
32+
; DXC: - Name: SFI0
33+
; DXC-NEXT: Size: 8
34+
; DXC-NEXT: Flags:
35+
; DXC: Int64Ops: true
36+
; DXC: ...

llvm/test/CodeGen/DirectX/ShaderFlags/rawbuffer-low-precision.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ define void @rawbuf() "hlsl.export" {
2323
@llvm.dx.resource.handlefrombinding.tdx.RawBuffer_v4i16_1_0t(i32 0, i32 1, i32 1, i32 0, i1 false, ptr null)
2424
%loadhalfrb = call { <4 x i16>, i1 }
2525
@llvm.dx.resource.load.rawbuffer.v4i16.tdx.RawBuffer_v4f16_0_0t(target("dx.RawBuffer", <4 x half>, 0, 0) %halfrb, i32 0, i32 0)
26-
%storei16rb = extractvalue { <4 x i16>, i1 } %loadhalfrb, 0
27-
call void @llvm.dx.resource.store.rawbuffer.tdx.RawBuffer_v4i16_1_0t.v4i16(target("dx.RawBuffer", <4 x i16>, 1, 0) %i16rb, i32 0, i32 0, <4 x i16> %storei16rb)
26+
%extracti16vec = extractvalue { <4 x i16>, i1 } %loadhalfrb, 0
27+
call void @llvm.dx.resource.store.rawbuffer.tdx.RawBuffer_v4i16_1_0t.v4i16(target("dx.RawBuffer", <4 x i16>, 1, 0) %i16rb, i32 0, i32 0, <4 x i16> %extracti16vec)
2828
ret void
2929
}
3030

0 commit comments

Comments
 (0)