brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 8226a10 Raw
28 lines · cpp
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 42// RUN: %clang_cc1 -triple spirv64-amd-amdhsa -aux-triple x86_64-pc-windows-msvc -x hip -emit-llvm -fcuda-is-device -o - %s | FileCheck %s3 4// Unlike OpenCL, HIP depends on the C++ interpration of "unsigned long", which5// is 64 bits long on Linux and 32 bits long on Windows. The return type of the6// ballot intrinsic needs to be a 64 bit integer on both platforms. This test7// cross-compiles to Windows to confirm that the return type is indeed 64 bits8// on Windows.9 10#define __device__ __attribute__((device))11 12// CHECK-LABEL: define spir_func noundef i64 @_Z3fooi(13// CHECK-SAME: i32 noundef [[P:%.*]]) addrspace(4) #[[ATTR0:[0-9]+]] {14// CHECK-NEXT:  entry:15// CHECK-NEXT:    [[RETVAL:%.*]] = alloca i64, align 816// CHECK-NEXT:    [[P_ADDR:%.*]] = alloca i32, align 417// CHECK-NEXT:    [[RETVAL_ASCAST:%.*]] = addrspacecast ptr [[RETVAL]] to ptr addrspace(4)18// CHECK-NEXT:    [[P_ADDR_ASCAST:%.*]] = addrspacecast ptr [[P_ADDR]] to ptr addrspace(4)19// CHECK-NEXT:    store i32 [[P]], ptr addrspace(4) [[P_ADDR_ASCAST]], align 420// CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr addrspace(4) [[P_ADDR_ASCAST]], align 421// CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i32 [[TMP0]], 022// CHECK-NEXT:    [[TMP1:%.*]] = call addrspace(4) i64 @llvm.amdgcn.ballot.i64(i1 [[TOBOOL]])23// CHECK-NEXT:    ret i64 [[TMP1]]24//25__device__ unsigned long long foo(int p) {26  return __builtin_amdgcn_ballot_w64(p);27}28