xref: /aosp_15_r20/external/clang/test/CodeGen/complex-init-list.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li // This file tests the clang extension which allows initializing the components
4*67e74705SXin Li // of a complex number individually using an initialization list.  (There is a
5*67e74705SXin Li // extensive description and test in test/Sema/complex-init-list.c.)
6*67e74705SXin Li 
7*67e74705SXin Li _Complex float x = { 1.0f, 1.0f/0.0f };
8*67e74705SXin Li // CHECK: @x = global { float, float } { float 1.000000e+00, float 0x7FF0000000000000 }, align 4
9*67e74705SXin Li 
f(float x,float y)10*67e74705SXin Li _Complex float f(float x, float y) { _Complex float z = { x, y }; return z; }
11*67e74705SXin Li // CHECK-LABEL: define <2 x float> @f
12*67e74705SXin Li // CHECK: alloca { float, float }
13*67e74705SXin Li // CHECK: alloca { float, float }
14*67e74705SXin Li 
f2(float x,float y)15*67e74705SXin Li _Complex float f2(float x, float y) { return (_Complex float){ x, y }; }
16*67e74705SXin Li // CHECK-LABEL: define <2 x float> @f2
17*67e74705SXin Li // CHECK: alloca { float, float }
18*67e74705SXin Li // CHECK: alloca { float, float }
19