1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_35 -verify-machineinstrs | FileCheck %s
2 ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_35 | %ptxas-verify %}
4 ; Verify that we correctly emit code for extending ldg/ldu. We do not expose
5 ; extending variants in the backend, but the ldg/ldu selection code may pick
6 ; extending loads as candidates. We do want to support this, so make sure we
7 ; emit the necessary cvt.* instructions to implement the extension and let ptxas
8 ; emit the real extending loads.
10 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
11 target triple = "nvptx64-nvidia-cuda"
14 define ptx_kernel void @spam(ptr addrspace(1) noalias nocapture readonly %arg, ptr addrspace(1) noalias nocapture %arg1, i64 %arg2, i64 %arg3) #0 {
16 %tmp5 = add nsw i64 %arg3, 8
17 %tmp6 = getelementptr i16, ptr addrspace(1) %arg, i64 %tmp5
18 ; CHECK: ld.global.nc.u16
19 %tmp7 = load i16, ptr addrspace(1) %tmp6, align 2
21 %tmp8 = sext i16 %tmp7 to i64
22 %tmp9 = mul nsw i64 %tmp8, %tmp8
23 %tmp10 = load i64, ptr addrspace(1) %arg1, align 8
24 %tmp11 = add nsw i64 %tmp9, %tmp10
25 store i64 %tmp11, ptr addrspace(1) %arg1, align 8
29 attributes #0 = { norecurse nounwind "polly.skip.fn" }
31 !nvvm.annotations = !{!0}
33 !0 = !{ptr @spam, !"maxntidx", i64 1, !"maxntidy", i64 1, !"maxntidz", i64 1}