|
1 |
| -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir |
| 1 | +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir |
2 | 2 | // RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
|
3 |
| -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll |
| 3 | +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll |
4 | 4 | // RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
|
5 |
| -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll |
| 5 | +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll |
6 | 6 | // RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
|
7 | 7 |
|
8 | 8 | int _Complex ci;
|
@@ -607,3 +607,22 @@ void foo24() {
|
607 | 607 | // OGCG: %[[RESULT_IMAG_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[RESULT]], i32 0, i32 1
|
608 | 608 | // OGCG: store i32 %[[ELEM_REAL]], ptr %[[RESULT_REAL_PTR]], align 4
|
609 | 609 | // OGCG: store i32 %[[ELEM_IMAG]], ptr %[[RESULT_IMAG_PTR]], align 4
|
| 610 | + |
| 611 | +template <double _Complex N> void template_foo() { double _Complex C = N; } |
| 612 | + |
| 613 | +void foo25() { |
| 614 | + template_foo<__builtin_complex(1.0, 2.0)>(); |
| 615 | +} |
| 616 | + |
| 617 | +// CIR: %[[INIT:.*]] = cir.alloca !cir.complex<!cir.double>, !cir.ptr<!cir.complex<!cir.double>>, ["C", init] |
| 618 | +// CIR: %[[COMPLEX:.*]] = cir.const #cir.const_complex<#cir.fp<1.000000e+00> : !cir.double, #cir.fp<2.000000e+00> : !cir.double> : !cir.complex<!cir.double> |
| 619 | +// CIR: cir.store{{.*}} %[[COMPLEX]], %[[INIT]] : !cir.complex<!cir.double>, !cir.ptr<!cir.complex<!cir.double>> |
| 620 | + |
| 621 | +// LLVM: %[[INIT:.*]] = alloca { double, double }, i64 1, align 8 |
| 622 | +// LLVM: store { double, double } { double 1.000000e+00, double 2.000000e+00 }, ptr %[[INIT]], align 8 |
| 623 | + |
| 624 | +// OGCG: %[[INIT:.*]] = alloca { double, double }, align 8 |
| 625 | +// OGCG: %[[INIT_REAL_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[INIT]], i32 0, i32 0 |
| 626 | +// OGCG: %[[INIT_IMAG_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[INIT]], i32 0, i32 1 |
| 627 | +// OGCG: store double 1.000000e+00, ptr %[[INIT_REAL_PTR]], align 8 |
| 628 | +// OGCG: store double 2.000000e+00, ptr %[[INIT_IMAG_PTR]], align 8 |
0 commit comments