52 lines · plain
1; RUN: opt %s -dxil-embed -S -o - | FileCheck %s2; RUN: llc %s --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC3target triple = "dxil-unknown-shadermodel6.5-library"4 5; Make sure triple is restored after updated to dxil.6; CHECK:target triple = "dxil-unknown-shadermodel6.5-library"7 8define i32 @add(i32 %a, i32 %b) {9 %sum = add i32 %a, %b10 ret i32 %sum11}12 13; CHECK: @dx.dxil = private constant [[BC_TYPE:\[[0-9]+ x i8\]]] c"BC\C0\DE{{[^"]+}}", section "DXIL", align 414 15; The dxil global should be the first here because we generate it before the16; other globals. If it isn't the first here, that's probably a bug.17; CHECK: @llvm.compiler.used = appending global {{\[[0-9]+ x ptr\]}} [ptr @dx.dxil18 19; This is using regex matches on some sizes, offsets and fields. These are all20; going to change as the DirectX backend continues to evolve and implement more21; features. Rather than extending this test to cover those future features, this22; test's matches are extremely fuzzy so that it won't break.23 24; DXC: --- !dxcontainer25; DXC-NEXT: Header:26; DXC-NEXT: Hash: [ 0x0, 0x0, 0x0,27; DXC: Version:28; DXC-NEXT: Major: 129; DXC-NEXT: Minor: 030; DXC-NEXT: FileSize: [[#]]31; DXC-NEXT: PartCount: [[#]]32; DXC-NEXT: PartOffsets: [ {{[0-9, ]+}} ]33; DXC-NEXT: Parts:34 35; In verifying the DXIL part, this test captures the size of the part, and36; derives the program header and dxil size fields from the part's size.37 38; DXC: - Name: DXIL39; DXC-NEXT: Size: [[#SIZE:]]40; DXC-NEXT: Program:41; DXC-NEXT: MajorVersion: 642; DXC-NEXT: MinorVersion: 543; DXC-NEXT: ShaderKind: 644; DXC-NEXT: Size: [[#div(SIZE,4)]]45; DXC-NEXT: DXILMajorVersion: 146; DXC-NEXT: DXILMinorVersion: 547; DXC-NEXT: DXILSize: [[#SIZE - 24]]48; DXC-NEXT: DXIL: [ 0x42, 0x43, 0xC0, 0xDE,49; DXC: - Name: SFI050; DXC-NEXT: Size: 851; DXC-NOT: Flags:52