Skip to content

Commit

Permalink
add DXIL test
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Gauër <[email protected]>
  • Loading branch information
Keenuts committed Nov 12, 2024
1 parent 5230473 commit 83cae6a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tools/clang/test/CodeGenDXIL/hlsl/types/type-enum-cast.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// RUN: %dxc -T vs_6_5 %s | FileCheck %s

enum UE : uint {
UA = 1
};

enum SE : int {
SA = 3
};

struct Output {
float u;
float s;
};

Output main(UE u : A, SE s : B) : C {
// CHECK-DAG: %[[U:.+]] = call i32 @dx.op.loadInput.i32(i32 4, i32 0, i32 0, i8 0, i32 undef)
// CHECK-DAG: %[[S:.+]] = call i32 @dx.op.loadInput.i32(i32 4, i32 1, i32 0, i8 0, i32 undef)

Output o;

o.u = u;
// CHECK-DAG: %[[FU:.+]] = uitofp i32 %[[U]] to float
// CHECK-DAG: call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 0, float %[[FU]])

o.s = s;
// CHECK-DAG: %[[FS:.+]] = sitofp i32 %[[S]] to float
// CHECK-DAG: call void @dx.op.storeOutput.f32(i32 5, i32 1, i32 0, i8 0, float %[[FS]])

return o;
}

0 comments on commit 83cae6a

Please sign in to comment.