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 i8 ldg/ldu. We do not expose 8-bit
5 ; registers in the backend, so these loads need special handling.
7 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
8 target triple = "nvptx64-unknown-unknown"
10 ; CHECK-LABEL: ex_zext
11 define void @ex_zext(ptr noalias readonly %data, ptr %res) {
13 ; CHECK: ld.global.nc.u8
14 %val = load i8, ptr %data
16 %valext = zext i8 %val to i32
17 store i32 %valext, ptr %res
21 ; CHECK-LABEL: ex_sext
22 define void @ex_sext(ptr noalias readonly %data, ptr %res) {
24 ; CHECK: ld.global.nc.u8
25 %val = load i8, ptr %data
27 %valext = sext i8 %val to i32
28 store i32 %valext, ptr %res
32 ; CHECK-LABEL: ex_zext_v2
33 define void @ex_zext_v2(ptr noalias readonly %data, ptr %res) {
35 ; CHECK: ld.global.nc.v2.u8
36 %val = load <2 x i8>, ptr %data
38 %valext = zext <2 x i8> %val to <2 x i32>
39 store <2 x i32> %valext, ptr %res
43 ; CHECK-LABEL: ex_sext_v2
44 define void @ex_sext_v2(ptr noalias readonly %data, ptr %res) {
46 ; CHECK: ld.global.nc.v2.u8
47 %val = load <2 x i8>, ptr %data
49 %valext = sext <2 x i8> %val to <2 x i32>
50 store <2 x i32> %valext, ptr %res
54 !nvvm.annotations = !{!0,!1,!2,!3}
55 !0 = !{ptr @ex_zext, !"kernel", i32 1}
56 !1 = !{ptr @ex_sext, !"kernel", i32 1}
57 !2 = !{ptr @ex_zext_v2, !"kernel", i32 1}
58 !3 = !{ptr @ex_sext_v2, !"kernel", i32 1}