Files
TheRock/compiler/amd-llvm/clang/test/Sema/builtins-reduction-math.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

171 lines
6.7 KiB
C

// RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-apple-darwin9
typedef float float4 __attribute__((ext_vector_type(4)));
typedef int int3 __attribute__((ext_vector_type(3)));
typedef unsigned unsigned4 __attribute__((ext_vector_type(4)));
struct Foo {
char *p;
};
void test_builtin_reduce_max(int i, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_max(iv);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
i = __builtin_reduce_max(v, v);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
i = __builtin_reduce_max();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_reduce_max(i);
// expected-error@-1 {{1st argument must be a vector type (was 'int')}}
}
void test_builtin_reduce_min(int i, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_min(iv);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
i = __builtin_reduce_min(v, v);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
i = __builtin_reduce_min();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_reduce_min(i);
// expected-error@-1 {{1st argument must be a vector type (was 'int')}}
}
void test_builtin_reduce_add(int i, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_add(iv);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
i = __builtin_reduce_add();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_reduce_add(iv, iv);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
i = __builtin_reduce_add(i);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}}
i = __builtin_reduce_add(v);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}}
}
void test_builtin_reduce_mul(int i, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_mul(iv);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
i = __builtin_reduce_mul();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_reduce_mul(iv, iv);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
i = __builtin_reduce_mul(i);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}}
i = __builtin_reduce_mul(v);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}}
}
void test_builtin_reduce_xor(int i, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_xor(iv);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
i = __builtin_reduce_xor();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_reduce_xor(iv, iv);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
i = __builtin_reduce_xor(i);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}}
i = __builtin_reduce_xor(v);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}}
}
void test_builtin_reduce_or(int i, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_or(iv);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
i = __builtin_reduce_or();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_reduce_or(iv, iv);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
i = __builtin_reduce_or(i);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}}
i = __builtin_reduce_or(v);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}}
}
void test_builtin_reduce_and(int i, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_and(iv);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
i = __builtin_reduce_and();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_reduce_and(iv, iv);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
i = __builtin_reduce_and(i);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}}
i = __builtin_reduce_and(v);
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}}
}
void test_builtin_reduce_maximum(int i, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_maximum(v);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
i = __builtin_reduce_maximum(v, v);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
i = __builtin_reduce_maximum();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_reduce_maximum(i);
// expected-error@-1 {{1st argument must be a vector of floating-point types (was 'int')}}
}
void test_builtin_reduce_minimum(int i, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_minimum(v);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
i = __builtin_reduce_minimum(v, v);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
i = __builtin_reduce_minimum();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_reduce_minimum(i);
// expected-error@-1 {{1st argument must be a vector of floating-point types (was 'int')}}
}
void test_builtin_reduce_addf(float f, float4 v, int3 iv) {
struct Foo s = __builtin_reduce_assoc_fadd(v);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
f = __builtin_reduce_in_order_fadd(v);
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
f = __builtin_reduce_in_order_fadd(v, f, f);
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
f = __builtin_reduce_assoc_fadd();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
f = __builtin_reduce_assoc_fadd(iv);
// expected-error@-1 {{1st argument must be a vector of floating-point types (was 'int3' (vector of 3 'int' values))}}
f = __builtin_reduce_in_order_fadd(v, (int)121);
// expected-error@-1 {{2nd argument must be a scalar floating-point type (was 'int')}}
}