| 1 |
; RUN: llvm-as %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -o %t.spv |
| 3 |
; RUN: spirv-val %t.spv |
| 4 |
; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 5 |
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc -emit-opaque-pointers |
| 6 |
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM |
| 7 |
|
| 8 |
source_filename = "math_builtin_float_half.cpp" |
| 9 |
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" |
| 10 |
target triple = "spirv64-unknown-unknown" |
| 11 |
|
| 12 |
; CHECK-SPIRV: 3 TypeFloat [[HALF:[0-9]+]] 16 |
| 13 |
; CHECK-SPIRV: 4 TypePointer [[HALFPTR:[0-9]+]] 7 [[HALF]] |
| 14 |
; CHECK-SPIRV: 4 TypeVector [[HALFV2:[0-9]+]] [[HALF]] 2 |
| 15 |
; CHECK-SPIRV: 4 TypePointer [[HALFV2PTR:[0-9]+]] 7 [[HALFV2]] |
| 16 |
; CHECK-SPIRV: 4 Constant [[HALF]] [[CONST:[0-9]+]] 14788 |
| 17 |
; CHECK-SPIRV: 4 Variable [[HALFPTR]] [[ADDR:[0-9]+]] 7 |
| 18 |
; CHECK-SPIRV: 4 Variable [[HALFV2PTR]] [[ADDR2:[0-9]+]] 7 |
| 19 |
; CHECK-SPIRV: 7 ExtInst [[HALF]] [[#]] 1 fract [[CONST]] [[ADDR]] |
| 20 |
; CHECK-SPIRV: 7 ExtInst [[HALFV2]] [[#]] 1 fract [[#]] [[ADDR2]] |
| 21 |
|
| 22 |
; CHECK-LLVM: %addr = alloca half |
| 23 |
; CHECK-LLVM: %addr2 = alloca <2 x half> |
| 24 |
; CHECK-LLVM: %res = call spir_func half @_Z5fractDhPDh(half 0xH39C4, ptr %addr) |
| 25 |
; CHECK-LLVM: %res2 = call spir_func <2 x half> @_Z5fractDv2_DhPS_(<2 x half> <half 0xH39C4, half 0xH0000>, ptr %addr2) |
| 26 |
|
| 27 |
define spir_kernel void @test() { |
| 28 |
entry: |
| 29 |
%addr = alloca half |
| 30 |
%addr2 = alloca <2 x half> |
| 31 |
%res = call spir_func noundef half @_Z17__spirv_ocl_fractDF16_PU3AS0DF16_(half noundef 0xH39C4, ptr noundef %addr) |
| 32 |
%res2 = call spir_func noundef <2 x half> @_Z17__spirv_ocl_fractDv2_DF16_PU3AS0S_(<2 x half> noundef <half 0xH39C4, half 0xH0000>, ptr noundef %addr2) |
| 33 |
ret void |
| 34 |
} |
| 35 |
|
| 36 |
declare spir_func noundef half @_Z17__spirv_ocl_fractDF16_PU3AS0DF16_(half noundef, ptr noundef) local_unnamed_addr |
| 37 |
|
| 38 |
declare spir_func noundef <2 x half> @_Z17__spirv_ocl_fractDv2_DF16_PU3AS0S_(<2 x half> noundef, ptr noundef) local_unnamed_addr |