Files
TheRock/compiler/amd-llvm/clang/test/C/C2y/n3259.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

67 lines
4.2 KiB
C

// RUN: %clang_cc1 -triple=x86_64 -std=c2y -Wall -pedantic -Wno-unused -Wpre-c2y-compat -verify=pre-c2y %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -triple=x86_64 -std=c23 -Wall -pedantic -Wno-unused %s -verify -emit-llvm -o - | FileCheck %s
/* WG14 N3259: Yes
* Support ++ and -- on complex values
*/
// CHECK-LABEL: define {{.*}} void @test()
void test() {
// CHECK: %[[F:.+]] = alloca { float, float }
// CHECK: store float 1
// CHECK: store float 0
_Complex float f = __builtin_complex(1.0f, 0.0f);
// CHECK: %[[F_REALP1:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 0
// CHECK-NEXT: %[[F_REAL:.+]] = load float, ptr %[[F_REALP1]]
// CHECK-NEXT: %[[F_IMAGP2:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 1
// CHECK-NEXT: %[[F_IMAG:.+]] = load float, ptr %[[F_IMAGP2]]
// CHECK-NEXT: %[[INC:.+]] = fadd float %[[F_REAL]], 1.000000e+00
// CHECK-NEXT: %[[F_REALP3:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 0
// CHECK-NEXT: %[[F_IMAGP4:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 1
// CHECK-NEXT: store float %[[INC]], ptr %[[F_REALP3]]
// CHECK-NEXT: store float %[[F_IMAG]], ptr %[[F_IMAGP4]]
f++; /* expected-warning {{'++' on an object of complex type is a C2y extension}}
pre-c2y-warning {{'++' on an object of complex type is incompatible with C standards before C2y}}
*/
// CHECK: %[[F_REALP5:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 0
// CHECK-NEXT: %[[F_REAL6:.+]] = load float, ptr %[[F_REALP5]]
// CHECK-NEXT: %[[F_IMAGP7:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 1
// CHECK-NEXT: %[[F_IMAG8:.+]] = load float, ptr %[[F_IMAGP7]]
// CHECK-NEXT: %[[INC9:.+]] = fadd float %[[F_REAL6]], 1.000000e+00
// CHECK-NEXT: %[[F_REALP10:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 0
// CHECK-NEXT: %[[F_IMAGP11:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 1
// CHECK-NEXT: store float %[[INC9]], ptr %[[F_REALP10]]
// CHECK-NEXT: store float %[[F_IMAG8]], ptr %[[F_IMAGP11]]
++f; /* expected-warning {{'++' on an object of complex type is a C2y extension}}
pre-c2y-warning {{'++' on an object of complex type is incompatible with C standards before C2y}}
*/
// CHECK: %[[F_REALP12:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 0
// CHECK-NEXT: %[[F_REAL13:.+]] = load float, ptr %[[F_REALP12]]
// CHECK-NEXT: %[[F_IMAGP14:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 1
// CHECK-NEXT: %[[F_IMAG15:.+]] = load float, ptr %[[F_IMAGP14]]
// CHECK-NEXT: %[[DEC:.+]] = fadd float %[[F_REAL13]], -1.000000e+00
// CHECK-NEXT: %[[F_REALP16:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 0
// CHECK-NEXT: %[[F_IMAGP17:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 1
// CHECK-NEXT: store float %[[DEC]], ptr %[[F_REALP16]]
// CHECK-NEXT: store float %[[F_IMAG15]], ptr %[[F_IMAGP17]]
f--; /* expected-warning {{'--' on an object of complex type is a C2y extension}}
pre-c2y-warning {{'--' on an object of complex type is incompatible with C standards before C2y}}
*/
// CHECK: %[[F_REALP18:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 0
// CHECK-NEXT: %[[F_REAL19:.+]] = load float, ptr %[[F_REALP18]]
// CHECK-NEXT: %[[F_IMAGP20:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 1
// CHECK-NEXT: %[[F_IMAG21:.+]] = load float, ptr %[[F_IMAGP20]]
// CHECK-NEXT: %[[DEC22:.+]] = fadd float %[[F_REAL19]], -1.000000e+00
// CHECK-NEXT: %[[F_REALP23:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 0
// CHECK-NEXT: %[[F_IMAGP24:.+]] = getelementptr inbounds nuw { float, float }, ptr %[[F]], i32 0, i32 1
// CHECK-NEXT: store float %[[DEC22]], ptr %[[F_REALP23]]
// CHECK-NEXT: store float %[[F_IMAG21]], ptr %[[F_IMAGP24]]
--f; /* expected-warning {{'--' on an object of complex type is a C2y extension}}
pre-c2y-warning {{'--' on an object of complex type is incompatible with C standards before C2y}}
*/
}