2018-05-10 07:46:19 +08:00
|
|
|
; RUN: llc -O0 < %s -march=nvptx -mcpu=sm_20 | FileCheck %s -check-prefixes=ALL,CLS32,G32
|
|
|
|
; RUN: llc -O0 < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s -check-prefixes=ALL,NOPTRCONV,CLS64,G64
|
|
|
|
; RUN: llc -O0 < %s -march=nvptx64 -mcpu=sm_20 --nvptx-short-ptr| FileCheck %s -check-prefixes=ALL,PTRCONV,CLS64,G64
|
2014-03-24 19:17:53 +08:00
|
|
|
|
2018-05-10 07:46:19 +08:00
|
|
|
; ALL-LABEL: conv1
|
2014-03-24 19:17:53 +08:00
|
|
|
define i32 @conv1(i32 addrspace(1)* %ptr) {
|
2018-05-10 07:46:19 +08:00
|
|
|
; G32: cvta.global.u32
|
|
|
|
; ALL-NOT: cvt.u64.u32
|
|
|
|
; G64: cvta.global.u64
|
|
|
|
; ALL: ld.u32
|
2014-03-24 19:17:53 +08:00
|
|
|
%genptr = addrspacecast i32 addrspace(1)* %ptr to i32*
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32* %genptr
|
2014-03-24 19:17:53 +08:00
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
2018-05-10 07:46:19 +08:00
|
|
|
; ALL-LABEL: conv2
|
2014-03-24 19:17:53 +08:00
|
|
|
define i32 @conv2(i32 addrspace(3)* %ptr) {
|
2018-05-10 07:46:19 +08:00
|
|
|
; CLS32: cvta.shared.u32
|
|
|
|
; PTRCONV: cvt.u64.u32
|
|
|
|
; NOPTRCONV-NOT: cvt.u64.u32
|
|
|
|
; CLS64: cvta.shared.u64
|
|
|
|
; ALL: ld.u32
|
2014-03-24 19:17:53 +08:00
|
|
|
%genptr = addrspacecast i32 addrspace(3)* %ptr to i32*
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32* %genptr
|
2014-03-24 19:17:53 +08:00
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
2018-05-10 07:46:19 +08:00
|
|
|
; ALL-LABEL: conv3
|
2014-03-24 19:17:53 +08:00
|
|
|
define i32 @conv3(i32 addrspace(4)* %ptr) {
|
2018-05-10 07:46:19 +08:00
|
|
|
; CLS32: cvta.const.u32
|
|
|
|
; PTRCONV: cvt.u64.u32
|
|
|
|
; NOPTRCONV-NOT: cvt.u64.u32
|
|
|
|
; CLS64: cvta.const.u64
|
|
|
|
; ALL: ld.u32
|
2014-03-24 19:17:53 +08:00
|
|
|
%genptr = addrspacecast i32 addrspace(4)* %ptr to i32*
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32* %genptr
|
2014-03-24 19:17:53 +08:00
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
2018-05-10 07:46:19 +08:00
|
|
|
; ALL-LABEL: conv4
|
2014-03-24 19:17:53 +08:00
|
|
|
define i32 @conv4(i32 addrspace(5)* %ptr) {
|
2018-05-10 07:46:19 +08:00
|
|
|
; CLS32: cvta.local.u32
|
|
|
|
; PTRCONV: cvt.u64.u32
|
|
|
|
; NOPTRCONV-NOT: cvt.u64.u32
|
|
|
|
; CLS64: cvta.local.u64
|
|
|
|
; ALL: ld.u32
|
2014-03-24 19:17:53 +08:00
|
|
|
%genptr = addrspacecast i32 addrspace(5)* %ptr to i32*
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32* %genptr
|
2014-03-24 19:17:53 +08:00
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
2018-05-10 07:46:19 +08:00
|
|
|
; ALL-LABEL: conv5
|
2014-03-24 19:17:53 +08:00
|
|
|
define i32 @conv5(i32* %ptr) {
|
2018-05-10 07:46:19 +08:00
|
|
|
; CLS32: cvta.to.global.u32
|
|
|
|
; ALL-NOT: cvt.u64.u32
|
|
|
|
; CLS64: cvta.to.global.u64
|
|
|
|
; ALL: ld.global.u32
|
2014-03-24 19:17:53 +08:00
|
|
|
%specptr = addrspacecast i32* %ptr to i32 addrspace(1)*
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32 addrspace(1)* %specptr
|
2014-03-24 19:17:53 +08:00
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
2018-05-10 07:46:19 +08:00
|
|
|
; ALL-LABEL: conv6
|
2014-03-24 19:17:53 +08:00
|
|
|
define i32 @conv6(i32* %ptr) {
|
2018-05-10 07:46:19 +08:00
|
|
|
; CLS32: cvta.to.shared.u32
|
|
|
|
; CLS64: cvta.to.shared.u64
|
|
|
|
; PTRCONV: cvt.u32.u64
|
|
|
|
; NOPTRCONV-NOT: cvt.u32.u64
|
|
|
|
; ALL: ld.shared.u32
|
2014-03-24 19:17:53 +08:00
|
|
|
%specptr = addrspacecast i32* %ptr to i32 addrspace(3)*
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32 addrspace(3)* %specptr
|
2014-03-24 19:17:53 +08:00
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
2018-05-10 07:46:19 +08:00
|
|
|
; ALL-LABEL: conv7
|
2014-03-24 19:17:53 +08:00
|
|
|
define i32 @conv7(i32* %ptr) {
|
2018-05-10 07:46:19 +08:00
|
|
|
; CLS32: cvta.to.const.u32
|
|
|
|
; CLS64: cvta.to.const.u64
|
|
|
|
; PTRCONV: cvt.u32.u64
|
|
|
|
; NOPTRCONV-NOT: cvt.u32.u64
|
|
|
|
; ALL: ld.const.u32
|
2014-03-24 19:17:53 +08:00
|
|
|
%specptr = addrspacecast i32* %ptr to i32 addrspace(4)*
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32 addrspace(4)* %specptr
|
2014-03-24 19:17:53 +08:00
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
2018-05-10 07:46:19 +08:00
|
|
|
; ALL-LABEL: conv8
|
2014-03-24 19:17:53 +08:00
|
|
|
define i32 @conv8(i32* %ptr) {
|
2018-05-10 07:46:19 +08:00
|
|
|
; CLS32: cvta.to.local.u32
|
|
|
|
; CLS64: cvta.to.local.u64
|
|
|
|
; PTRCONV: cvt.u32.u64
|
|
|
|
; NOPTRCONV-NOT: cvt.u32.u64
|
|
|
|
; ALL: ld.local.u32
|
2014-03-24 19:17:53 +08:00
|
|
|
%specptr = addrspacecast i32* %ptr to i32 addrspace(5)*
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32 addrspace(5)* %specptr
|
2014-03-24 19:17:53 +08:00
|
|
|
ret i32 %val
|
|
|
|
}
|