
Implement support for HLSL intrinsic saturate. Implement DXIL codegen for the intrinsic saturate by lowering it to DXIL Op dx.saturate. Implement SPIRV codegen by transforming saturate(x) to clamp(x, 0.0f, 1.0f). Add tests for DXIL and SPIRV CodeGen.
11 lines
344 B
LLVM
11 lines
344 B
LLVM
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
|
|
|
|
; DXIL operation saturate does not support i32 overload
|
|
; CHECK: invalid intrinsic signature
|
|
|
|
define noundef i32 @test_saturate_i32(i32 noundef %p0) #0 {
|
|
entry:
|
|
%hlsl.saturate = call i32 @llvm.dx.saturate.i32(i32 %p0)
|
|
ret i32 %hlsl.saturate
|
|
}
|