| 1 |
; RUN: llvm-as %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_INTEL_16bit_atomics |
| 3 |
; RUN: llvm-spirv -to-text %t.spv -o %t.spt |
| 4 |
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV |
| 5 |
|
| 6 |
; RUN: llvm-spirv -r --spirv-target-env=CL2.0 %t.spv -o %t.rev.bc |
| 7 |
; RUN: llvm-dis %t.rev.bc |
| 8 |
; RUN: FileCheck < %t.rev.ll %s --check-prefixes=CHECK-LLVM |
| 9 |
|
| 10 |
; RUN: llvm-spirv -r --spirv-target-env="SPV-IR" %t.spv -o %t.rev.bc |
| 11 |
; RUN: llvm-dis %t.rev.bc |
| 12 |
; RUN: FileCheck < %t.rev.ll %s --check-prefixes=CHECK-LLVM-SPV-IR |
| 13 |
|
| 14 |
; Check that without extension we don't use its capabilities - there is no |
| 15 |
; limitation on using i16 with atomic instruction in the core specification. |
| 16 |
; RUN: llvm-spirv %t.bc -o %t.noext.spv |
| 17 |
; RUN: spirv-val %t.noext.spv |
| 18 |
; RUN: llvm-spirv -to-text %t.noext.spv -o %t.noext.spt |
| 19 |
; RUN: FileCheck < %t.noext.spt %s --check-prefix=CHECK-SPIRV-NOEXT |
| 20 |
|
| 21 |
; CHECK-SPIRV: Capability Int16 |
| 22 |
; CHECK-SPIRV: Capability AtomicInt16CompareExchangeINTEL |
| 23 |
; CHECK-SPIRV: Capability Int16AtomicsINTEL |
| 24 |
; CHECK-SPIRV: Extension "SPV_INTEL_16bit_atomics" |
| 25 |
; CHECK-SPIRV: AtomicOr |
| 26 |
|
| 27 |
; CHECK-SPIRV-NOEXT: Capability Int16 |
| 28 |
; CHECK-SPIRV-NOEXT-NOT: Capability AtomicInt16CompareExchangeINTEL |
| 29 |
; CHECK-SPIRV-NOEXT-NOT: Capability Int16AtomicsINTEL |
| 30 |
; CHECK-SPIRV-NOEXT-NOT: Extension "SPV_INTEL_16bit_atomics" |
| 31 |
|
| 32 |
; CHECK-LLVM: call spir_func i16 @_Z24atomic_fetch_or_explicitPU3AS4VU7_Atomicss12memory_order12memory_scope |
| 33 |
; CHECK-LLVM-SPV-IR: call spir_func i16 @_Z16__spirv_AtomicOrPU3AS1siis |
| 34 |
|
| 35 |
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" |
| 36 |
target triple = "spir64" |
| 37 |
|
| 38 |
@ui = common dso_local addrspace(1) global i16 0, align 4 |
| 39 |
|
| 40 |
define dso_local spir_func void @test() { |
| 41 |
entry: |
| 42 |
%0 = atomicrmw or ptr addrspace(1) @ui, i16 42 release |
| 43 |
ret void |
| 44 |
} |