[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / CodeGenOpenCL / numbered-address-space.cl
blobbfbc1d6873551083c1e989f87f85466592e34cc3
1 // REQUIRES: amdgpu-registered-target
2 // RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu tonga -emit-llvm -O0 -o - %s | FileCheck %s
4 // Make sure using numbered address spaces doesn't trigger crashes when a
5 // builtin has an address space parameter.
7 // CHECK-LABEL: @test_numbered_as_to_generic(
8 // CHECK: addrspacecast ptr addrspace(42) %0 to ptr
9 void test_numbered_as_to_generic(__attribute__((address_space(42))) int *arbitary_numbered_ptr) {
10 generic int* generic_ptr = arbitary_numbered_ptr;
11 *generic_ptr = 4;
14 // CHECK-LABEL: @test_generic_as_to_builtin_parameter_explicit_cast(
15 // CHECK: addrspacecast ptr addrspace(3) %0 to ptr
16 void test_generic_as_to_builtin_parameter_explicit_cast(__local int *local_ptr, float src) {
17 generic int* generic_ptr = local_ptr;
18 volatile float result = __builtin_amdgcn_ds_fmaxf((__local float*) generic_ptr, src, 0, 0, false);
21 // CHECK-LABEL: @test_generic_as_to_builtin_parameter_implicit_cast(
22 void test_generic_as_to_builtin_parameter_implicit_cast(__local int *local_ptr, float src) {
23 volatile float result = __builtin_amdgcn_ds_fmaxf(local_ptr, src, 0, 0, false);