-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a92e64d
commit 0ce2597
Showing
9 changed files
with
110 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-pixel %s -fnative-half-type -emit-llvm -o - | FileCheck %s | ||
|
||
RWBuffer<float4> Buf; | ||
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-pixel %s -fnative-half-type -emit-llvm -o - | FileCheck %s | ||
|
||
//CHECK-LABEL: define void @main() | ||
float4 main( ) { | ||
float4 p1 = Buf[0]; | ||
void test(float Buf) { | ||
//CHECK: [[LOAD:%.*]] = load <4 x float>, ptr %p1{{.*}}, align 16 | ||
//CHECK-NEXT: [[EXTR:%.*]] = extractelement <4 x float> [[LOAD]], i32 3 | ||
//CHECK-NEXT: [[FCMP:%.*]] = fcmp olt float [[EXTR]], 0.000000e+00 | ||
//CHECK-NEXT: call void @llvm.dx.clip(i1 [[FCMP]]) | ||
clip(p1.a); | ||
return p1; | ||
clip(Buf); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
; RUN: opt -S -dxil-intrinsic-expansion -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-pixel %s | FileCheck %s | ||
|
||
; CHECK-LABEL: define void @test_dxil_lowering | ||
; CHECK: call void @dx.op.discard(i32 82, i1 %0) | ||
; | ||
define void @test_dxil_lowering(float noundef %p) #0 { | ||
entry: | ||
%0 = fcmp olt float %p, 0.000000e+00 | ||
call void @llvm.dx.clip(i1 %0) | ||
ret void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s | ||
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} | ||
|
||
|
||
; CHECK-LABEL: define void @test_dxil_lowering | ||
; CHECK: call void @dx.op.discard(i32 82, i1 %0) | ||
; | ||
define spir_func void @test_dxil_lowering(float noundef %Buf) #0 { | ||
entry: | ||
%Buf.addr = alloca float, align 4 | ||
store float %Buf, ptr %Buf.addr, align 4 | ||
%1 = load float, ptr %Buf.addr, align 4 | ||
%2 = fcmp olt float %1, 0.000000e+00 | ||
call void @llvm.spv.clip(i1 %2) | ||
ret void | ||
} | ||
|
||
declare void @llvm.spv.clip(i1) #1 |