46 lines · c
1// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s2 3// Test checks that 'mode' attribute is handled correctly with enums, i. e. code4// 1. "typedef enum { A } __attribute__((mode(HI))) T;" is accepted,5// 2. "enum X __attribute__((mode(QI))) var;" forms a complete integer type.6 7int main(void) {8 // CHECK: [[X1:%.+]] = alloca i89 enum { A1, B1 } __attribute__((mode(QI))) x1 = A1;10 11 // CHECK: [[X2:%.+]] = alloca i1612 enum { A2, B2 } x2 __attribute__((mode(HI))) = B2;13 14 // CHECK: [[X3:%.+]] = alloca i3215 typedef enum { A3, B3 } __attribute__((mode(SI))) T3;16 T3 x3 = A3;17 18 // CHECK: [[X4:%.+]] = alloca i6419 typedef enum { A4, B4 } T4 __attribute__((mode(DI)));20 T4 x4 = B4;21 22 // CHECK: [[X5:%.+]] = alloca i823 typedef enum __attribute__((mode(QI))) { A5, B5 } T5;24 T5 x5 = A5;25 26 // CHECK: [[X6:%.+]] = alloca i827 typedef enum X __attribute__((mode(QI))) T6;28 T6 x6;29 30 // CHECK: [[X7:%.+]] = alloca i12831 enum { A7, B7 } __attribute__((mode(TI))) x7 = A7;32 33 // CHECK: [[X8:%.+]] = alloca i834 enum __attribute__((mode(QI))) { A8, B8 } x8 = B8;35 36 // CHECK: store i8 0, ptr [[X1]]37 // CHECK: store i16 1, ptr [[X2]]38 // CHECK: store i32 0, ptr [[X3]]39 // CHECK: store i64 1, ptr [[X4]]40 // CHECK: store i8 0, ptr [[X5]]41 // CHECK: store i128 0, ptr [[X7]]42 // CHECK: store i8 1, ptr [[X8]]43 44 return x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8;45}46