25 lines · c
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir2// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR3// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll4// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM5// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll6// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG7 8void foo() {9 int a;10 int r = _Generic(a, double: 1, float: 2, int: 3, default: 4);11}12 13// CIR: %[[A:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["a"]14// CIR: %[[RES:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["r", init]15// CIR: %[[RES_VAL:.*]] = cir.const #cir.int<3> : !s32i16// CIR: cir.store{{.*}} %[[RES_VAL]], %[[RES]] : !s32i, !cir.ptr<!s32i>17 18// LLVM: %[[A:.*]] = alloca i32, i64 1, align 419// LLVM: %[[RES:.*]] = alloca i32, i64 1, align 420// LLVM: store i32 3, ptr %[[RES]], align 421 22// OGCG: %[[A:.*]] = alloca i32, align 423// OGCG: %[[RES:.*]] = alloca i32, align 424// OGCG: store i32 3, ptr %[[RES]], align 425