| 1 |
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 2 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %} |
| 3 |
|
| 4 |
; CHECK-SPIRV: %[[#]] = OpExtInst %[[#]] %[[#]] fclamp |
| 5 |
; CHECK-SPIRV-NOT: %[[#]] = OpExtInst %[[#]] %[[#]] clamp |
| 6 |
|
| 7 |
define spir_kernel void @test_scalar(ptr addrspace(1) nocapture readonly %f) { |
| 8 |
entry: |
| 9 |
%0 = load float, ptr addrspace(1) %f, align 4 |
| 10 |
%call = tail call spir_func float @_Z5clampfff(float %0, float 0.000000e+00, float 1.000000e+00) |
| 11 |
%1 = load float, ptr addrspace(1) %f, align 4 |
| 12 |
%conv = fptrunc float %1 to half |
| 13 |
%call1 = tail call spir_func half @_Z5clampDhDhDh(half %conv, half %conv, half %conv) |
| 14 |
ret void |
| 15 |
} |
| 16 |
|
| 17 |
declare spir_func float @_Z5clampfff(float, float, float) |
| 18 |
|
| 19 |
declare spir_func half @_Z5clampDhDhDh(half, half, half) |