Files
TheRock/compiler/amd-llvm/clang/test/CodeGen/attr-mode-enums.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

46 lines
1.4 KiB
C

// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
// Test checks that 'mode' attribute is handled correctly with enums, i. e. code
// 1. "typedef enum { A } __attribute__((mode(HI))) T;" is accepted,
// 2. "enum X __attribute__((mode(QI))) var;" forms a complete integer type.
int main(void) {
// CHECK: [[X1:%.+]] = alloca i8
enum { A1, B1 } __attribute__((mode(QI))) x1 = A1;
// CHECK: [[X2:%.+]] = alloca i16
enum { A2, B2 } x2 __attribute__((mode(HI))) = B2;
// CHECK: [[X3:%.+]] = alloca i32
typedef enum { A3, B3 } __attribute__((mode(SI))) T3;
T3 x3 = A3;
// CHECK: [[X4:%.+]] = alloca i64
typedef enum { A4, B4 } T4 __attribute__((mode(DI)));
T4 x4 = B4;
// CHECK: [[X5:%.+]] = alloca i8
typedef enum __attribute__((mode(QI))) { A5, B5 } T5;
T5 x5 = A5;
// CHECK: [[X6:%.+]] = alloca i8
typedef enum X __attribute__((mode(QI))) T6;
T6 x6;
// CHECK: [[X7:%.+]] = alloca i128
enum { A7, B7 } __attribute__((mode(TI))) x7 = A7;
// CHECK: [[X8:%.+]] = alloca i8
enum __attribute__((mode(QI))) { A8, B8 } x8 = B8;
// CHECK: store i8 0, ptr [[X1]]
// CHECK: store i16 1, ptr [[X2]]
// CHECK: store i32 0, ptr [[X3]]
// CHECK: store i64 1, ptr [[X4]]
// CHECK: store i8 0, ptr [[X5]]
// CHECK: store i128 0, ptr [[X7]]
// CHECK: store i8 1, ptr [[X8]]
return x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8;
}