| 1 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir -mmlir --mlir-print-ir-before=cir-canonicalize -o %t.cir %s 2>&1 | FileCheck --check-prefix=CIR-BEFORE %s |
| 2 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir -mmlir --mlir-print-ir-after=cir-lowering-prepare -o %t.cir %s 2>&1 | FileCheck --check-prefixes=CIR-AFTER %s |
| 3 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll |
| 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 |
| 6 |
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG |
| 7 |
|
| 8 |
void foo() { |
| 9 |
int _Complex a; |
| 10 |
int _Complex b = ~a; |
| 11 |
} |
| 12 |
|
| 13 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>, ["a"] |
| 14 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>, ["b", init] |
| 15 |
// CIR-BEFORE: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!s32i>>, !cir.complex<!s32i> |
| 16 |
// CIR-BEFORE: %[[COMPLEX_NOT:.*]] = cir.unary(not, %[[TMP]]) : !cir.complex<!s32i>, !cir.complex<!s32i> |
| 17 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_NOT]], %[[B_ADDR]] : !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>> |
| 18 |
|
| 19 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>, ["a"] |
| 20 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>, ["b", init] |
| 21 |
// CIR-AFTER: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!s32i>>, !cir.complex<!s32i> |
| 22 |
// CIR-AFTER: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!s32i> -> !s32i |
| 23 |
// CIR-AFTER: %[[IMAG:.*]] = cir.complex.imag %[[TMP]] : !cir.complex<!s32i> -> !s32i |
| 24 |
// CIR-AFTER: %[[IMAG_MINUS:.*]] = cir.unary(minus, %[[IMAG]]) : !s32i, !s32i |
| 25 |
// CIR-AFTER: %[[RESULT_VAL:.*]] = cir.complex.create %[[REAL]], %[[IMAG_MINUS]] : !s32i -> !cir.complex<!s32i> |
| 26 |
// CIR-AFTER: cir.store{{.*}} %[[RESULT_VAL]], %[[B_ADDR]] : !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>> |
| 27 |
|
| 28 |
// LLVM: %[[A_ADDR:.*]] = alloca { i32, i32 }, i64 1, align 4 |
| 29 |
// LLVM: %[[B_ADDR:.*]] = alloca { i32, i32 }, i64 1, align 4 |
| 30 |
// LLVM: %[[TMP:.*]] = load { i32, i32 }, ptr %[[A_ADDR]], align 4 |
| 31 |
// LLVM: %[[REAL:.*]] = extractvalue { i32, i32 } %[[TMP]], 0 |
| 32 |
// LLVM: %[[IMAG:.*]] = extractvalue { i32, i32 } %[[TMP]], 1 |
| 33 |
// LLVM: %[[IMAG_MINUS:.*]] = sub i32 0, %[[IMAG]] |
| 34 |
// LLVM: %[[RESULT_TMP:.*]] = insertvalue { i32, i32 } {{.*}}, i32 %[[REAL]], 0 |
| 35 |
// LLVM: %[[RESULT_VAL:.*]] = insertvalue { i32, i32 } %[[RESULT_TMP]], i32 %[[IMAG_MINUS]], 1 |
| 36 |
// LLVM: store { i32, i32 } %[[RESULT_VAL]], ptr %[[B_ADDR]], align 4 |
| 37 |
|
| 38 |
// OGCG: %[[A_ADDR:.*]] = alloca { i32, i32 }, align 4 |
| 39 |
// OGCG: %[[B_ADDR:.*]] = alloca { i32, i32 }, align 4 |
| 40 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 41 |
// OGCG: %[[A_REAL:.*]] = load i32, ptr %[[A_REAL_PTR]], align 4 |
| 42 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 43 |
// OGCG: %[[A_IMAG:.*]] = load i32, ptr %[[A_IMAG_PTR]], align 4 |
| 44 |
// OGCG: %[[A_IMAG_MINUS:.*]] = sub i32 0, %[[A_IMAG]] |
| 45 |
// OGCG: %[[RESULT_REAL_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 46 |
// OGCG: %[[RESULT_IMAG_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 47 |
// OGCG: store i32 %[[A_REAL]], ptr %[[RESULT_REAL_PTR]], align 4 |
| 48 |
// OGCG: store i32 %[[A_IMAG_MINUS]], ptr %[[RESULT_IMAG_PTR]], align 4 |
| 49 |
|
| 50 |
void foo2() { |
| 51 |
float _Complex a; |
| 52 |
float _Complex b = ~a; |
| 53 |
} |
| 54 |
|
| 55 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 56 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 57 |
// CIR-BEFORE: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 58 |
// CIR-BEFORE: %[[COMPLEX_NOT:.*]] = cir.unary(not, %[[TMP]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 59 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_NOT]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 60 |
|
| 61 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 62 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 63 |
// CIR-AFTER: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 64 |
// CIR-AFTER: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 65 |
// CIR-AFTER: %[[IMAG:.*]] = cir.complex.imag %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 66 |
// CIR-AFTER: %[[IMAG_MINUS:.*]] = cir.unary(minus, %[[IMAG]]) : !cir.float, !cir.float |
| 67 |
// CIR-AFTER: %[[RESULT_VAL:.*]] = cir.complex.create %[[REAL]], %[[IMAG_MINUS]] : !cir.float -> !cir.complex<!cir.float> |
| 68 |
// CIR-AFTER: cir.store{{.*}} %[[RESULT_VAL]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 69 |
|
| 70 |
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 71 |
// LLVM: %[[B_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 72 |
// LLVM: %[[TMP:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4 |
| 73 |
// LLVM: %[[REAL:.*]] = extractvalue { float, float } %[[TMP]], 0 |
| 74 |
// LLVM: %[[IMAG:.*]] = extractvalue { float, float } %[[TMP]], 1 |
| 75 |
// LLVM: %[[IMAG_MINUS:.*]] = fneg float %[[IMAG]] |
| 76 |
// LLVM: %[[RESULT_TMP:.*]] = insertvalue { float, float } {{.*}}, float %[[REAL]], 0 |
| 77 |
// LLVM: %[[RESULT_VAL:.*]] = insertvalue { float, float } %[[RESULT_TMP]], float %[[IMAG_MINUS]], 1 |
| 78 |
// LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[B_ADDR]], align 4 |
| 79 |
|
| 80 |
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 |
| 81 |
// OGCG: %[[B_ADDR:.*]] = alloca { float, float }, align 4 |
| 82 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 83 |
// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 |
| 84 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 85 |
// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 |
| 86 |
// OGCG: %[[A_IMAG_MINUS:.*]] = fneg float %[[A_IMAG]] |
| 87 |
// OGCG: %[[RESULT_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 88 |
// OGCG: %[[RESULT_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 89 |
// OGCG: store float %[[A_REAL]], ptr %[[RESULT_REAL_PTR]], align 4 |
| 90 |
// OGCG: store float %[[A_IMAG_MINUS]], ptr %[[RESULT_IMAG_PTR]], align 4 |
| 91 |
|
| 92 |
void foo3() { |
| 93 |
float _Complex a; |
| 94 |
float _Complex b = a++; |
| 95 |
} |
| 96 |
|
| 97 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 98 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 99 |
// CIR-BEFORE: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 100 |
// CIR-BEFORE: %[[COMPLEX_INC:.*]] = cir.unary(inc, %[[TMP]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 101 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_INC]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 102 |
// CIR-BEFORE: cir.store{{.*}} %[[TMP]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 103 |
|
| 104 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 105 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 106 |
// CIR-AFTER: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 107 |
// CIR-AFTER: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 108 |
// CIR-AFTER: %[[IMAG:.*]] = cir.complex.imag %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 109 |
// CIR-AFTER: %[[REAL_INC:.*]] = cir.unary(inc, %[[REAL]]) : !cir.float, !cir.float |
| 110 |
// CIR-AFTER: %[[NEW_COMPLEX:.*]] = cir.complex.create %[[REAL_INC]], %[[IMAG]] : !cir.float -> !cir.complex<!cir.float> |
| 111 |
// CIR-AFTER: cir.store{{.*}} %[[NEW_COMPLEX]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 112 |
// CIR-AFTER: cir.store{{.*}} %[[TMP]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 113 |
|
| 114 |
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 115 |
// LLVM: %[[B_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 116 |
// LLVM: %[[TMP:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4 |
| 117 |
// LLVM: %[[REAL:.*]] = extractvalue { float, float } %[[TMP]], 0 |
| 118 |
// LLVM: %[[IMAG:.*]] = extractvalue { float, float } %[[TMP]], 1 |
| 119 |
// LLVM: %[[REAL_INC:.*]] = fadd float 1.000000e+00, %[[REAL]] |
| 120 |
// LLVM: %[[RESULT_TMP:.*]] = insertvalue { float, float } {{.*}}, float %[[REAL_INC]], 0 |
| 121 |
// LLVM: %[[RESULT_VAL:.*]] = insertvalue { float, float } %[[RESULT_TMP]], float %[[IMAG]], 1 |
| 122 |
// LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[A_ADDR]], align 4 |
| 123 |
// LLVM: store { float, float } %[[TMP]], ptr %[[B_ADDR]], align 4 |
| 124 |
|
| 125 |
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 |
| 126 |
// OGCG: %[[B_ADDR:.*]] = alloca { float, float }, align 4 |
| 127 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 128 |
// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 |
| 129 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 130 |
// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 |
| 131 |
// OGCG: %[[A_REAL_INC:.*]] = fadd float %[[A_REAL]], 1.000000e+00 |
| 132 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 133 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 134 |
// OGCG: store float %[[A_REAL_INC]], ptr %[[A_REAL_PTR]], align 4 |
| 135 |
// OGCG: store float %[[A_IMAG]], ptr %[[A_IMAG_PTR]], align 4 |
| 136 |
// OGCG: %[[RESULT_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 137 |
// OGCG: %[[RESULT_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 138 |
// OGCG: store float %[[A_REAL]], ptr %[[RESULT_REAL_PTR]], align 4 |
| 139 |
// OGCG: store float %[[A_IMAG]], ptr %[[RESULT_IMAG_PTR]], align 4 |
| 140 |
|
| 141 |
void foo4() { |
| 142 |
float _Complex a; |
| 143 |
float _Complex b = ++a; |
| 144 |
} |
| 145 |
|
| 146 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 147 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 148 |
// CIR-BEFORE: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 149 |
// CIR-BEFORE: %[[COMPLEX_INC:.*]] = cir.unary(inc, %[[TMP]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 150 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_INC]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 151 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_INC]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 152 |
|
| 153 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 154 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 155 |
// CIR-AFTER: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 156 |
// CIR-AFTER: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 157 |
// CIR-AFTER: %[[IMAG:.*]] = cir.complex.imag %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 158 |
// CIR-AFTER: %[[REAL_INC:.*]] = cir.unary(inc, %[[REAL]]) : !cir.float, !cir.float |
| 159 |
// CIR-AFTER: %[[NEW_COMPLEX:.*]] = cir.complex.create %[[REAL_INC]], %[[IMAG]] : !cir.float -> !cir.complex<!cir.float> |
| 160 |
// CIR-AFTER: cir.store{{.*}} %[[NEW_COMPLEX]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 161 |
// CIR-AFTER: cir.store{{.*}} %[[NEW_COMPLEX]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 162 |
|
| 163 |
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 164 |
// LLVM: %[[B_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 165 |
// LLVM: %[[TMP:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4 |
| 166 |
// LLVM: %[[REAL:.*]] = extractvalue { float, float } %[[TMP]], 0 |
| 167 |
// LLVM: %[[IMAG:.*]] = extractvalue { float, float } %[[TMP]], 1 |
| 168 |
// LLVM: %[[REAL_INC:.*]] = fadd float 1.000000e+00, %[[REAL]] |
| 169 |
// LLVM: %[[RESULT_TMP:.*]] = insertvalue { float, float } {{.*}}, float %[[REAL_INC]], 0 |
| 170 |
// LLVM: %[[RESULT_VAL:.*]] = insertvalue { float, float } %[[RESULT_TMP]], float %[[IMAG]], 1 |
| 171 |
// LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[A_ADDR]], align 4 |
| 172 |
// LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[B_ADDR]], align 4 |
| 173 |
|
| 174 |
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 |
| 175 |
// OGCG: %[[B_ADDR:.*]] = alloca { float, float }, align 4 |
| 176 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 177 |
// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 |
| 178 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 179 |
// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 |
| 180 |
// OGCG: %[[A_REAL_INC:.*]] = fadd float %[[A_REAL]], 1.000000e+00 |
| 181 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 182 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 183 |
// OGCG: store float %[[A_REAL_INC]], ptr %[[A_REAL_PTR]], align 4 |
| 184 |
// OGCG: store float %[[A_IMAG]], ptr %[[A_IMAG_PTR]], align 4 |
| 185 |
// OGCG: %[[RESULT_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 186 |
// OGCG: %[[RESULT_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 187 |
// OGCG: store float %[[A_REAL_INC]], ptr %[[RESULT_REAL_PTR]], align 4 |
| 188 |
// OGCG: store float %[[A_IMAG]], ptr %[[RESULT_IMAG_PTR]], align 4 |
| 189 |
|
| 190 |
void foo5() { |
| 191 |
float _Complex a; |
| 192 |
float _Complex b = a--; |
| 193 |
} |
| 194 |
|
| 195 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 196 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 197 |
// CIR-BEFORE: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 198 |
// CIR-BEFORE: %[[COMPLEX_DEC:.*]] = cir.unary(dec, %[[TMP]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 199 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_DEC]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 200 |
// CIR-BEFORE: cir.store{{.*}} %[[TMP]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 201 |
|
| 202 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 203 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 204 |
// CIR-AFTER: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 205 |
// CIR-AFTER: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 206 |
// CIR-AFTER: %[[IMAG:.*]] = cir.complex.imag %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 207 |
// CIR-AFTER: %[[REAL_DEC:.*]] = cir.unary(dec, %[[REAL]]) : !cir.float, !cir.float |
| 208 |
// CIR-AFTER: %[[NEW_COMPLEX:.*]] = cir.complex.create %[[REAL_DEC]], %[[IMAG]] : !cir.float -> !cir.complex<!cir.float> |
| 209 |
// CIR-AFTER: cir.store{{.*}} %[[NEW_COMPLEX]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 210 |
// CIR-AFTER: cir.store{{.*}} %[[TMP]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 211 |
|
| 212 |
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 213 |
// LLVM: %[[B_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 214 |
// LLVM: %[[TMP:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4 |
| 215 |
// LLVM: %[[REAL:.*]] = extractvalue { float, float } %[[TMP]], 0 |
| 216 |
// LLVM: %[[IMAG:.*]] = extractvalue { float, float } %[[TMP]], 1 |
| 217 |
// LLVM: %[[REAL_DEC:.*]] = fadd float -1.000000e+00, %[[REAL]] |
| 218 |
// LLVM: %[[RESULT_TMP:.*]] = insertvalue { float, float } {{.*}}, float %[[REAL_DEC]], 0 |
| 219 |
// LLVM: %[[RESULT_VAL:.*]] = insertvalue { float, float } %[[RESULT_TMP]], float %[[IMAG]], 1 |
| 220 |
// LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[A_ADDR]], align 4 |
| 221 |
// LLVM: store { float, float } %[[TMP]], ptr %[[B_ADDR]], align 4 |
| 222 |
|
| 223 |
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 |
| 224 |
// OGCG: %[[B_ADDR:.*]] = alloca { float, float }, align 4 |
| 225 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 226 |
// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 |
| 227 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 228 |
// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 |
| 229 |
// OGCG: %[[A_REAL_DEC:.*]] = fadd float %[[A_REAL]], -1.000000e+00 |
| 230 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 231 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 232 |
// OGCG: store float %[[A_REAL_DEC]], ptr %[[A_REAL_PTR]], align 4 |
| 233 |
// OGCG: store float %[[A_IMAG]], ptr %[[A_IMAG_PTR]], align 4 |
| 234 |
// OGCG: %[[RESULT_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 235 |
// OGCG: %[[RESULT_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 236 |
// OGCG: store float %[[A_REAL]], ptr %[[RESULT_REAL_PTR]], align 4 |
| 237 |
// OGCG: store float %[[A_IMAG]], ptr %[[RESULT_IMAG_PTR]], align 4 |
| 238 |
|
| 239 |
void foo6() { |
| 240 |
float _Complex a; |
| 241 |
float _Complex b = --a; |
| 242 |
} |
| 243 |
|
| 244 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 245 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 246 |
// CIR-BEFORE: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 247 |
// CIR-BEFORE: %[[COMPLEX_DEC:.*]] = cir.unary(dec, %[[TMP]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 248 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_DEC]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 249 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_DEC]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 250 |
|
| 251 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 252 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 253 |
// CIR-AFTER: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 254 |
// CIR-AFTER: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 255 |
// CIR-AFTER: %[[IMAG:.*]] = cir.complex.imag %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 256 |
// CIR-AFTER: %[[REAL_DEC:.*]] = cir.unary(dec, %[[REAL]]) : !cir.float, !cir.float |
| 257 |
// CIR-AFTER: %[[NEW_COMPLEX:.*]] = cir.complex.create %[[REAL_DEC]], %[[IMAG]] : !cir.float -> !cir.complex<!cir.float> |
| 258 |
// CIR-AFTER: cir.store{{.*}} %[[NEW_COMPLEX]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 259 |
// CIR-AFTER: cir.store{{.*}} %[[NEW_COMPLEX]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 260 |
|
| 261 |
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 262 |
// LLVM: %[[B_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 263 |
// LLVM: %[[TMP:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4 |
| 264 |
// LLVM: %[[REAL:.*]] = extractvalue { float, float } %[[TMP]], 0 |
| 265 |
// LLVM: %[[IMAG:.*]] = extractvalue { float, float } %[[TMP]], 1 |
| 266 |
// LLVM: %[[REAL_DEC:.*]] = fadd float -1.000000e+00, %[[REAL]] |
| 267 |
// LLVM: %[[RESULT_TMP:.*]] = insertvalue { float, float } {{.*}}, float %[[REAL_DEC]], 0 |
| 268 |
// LLVM: %[[RESULT_VAL:.*]] = insertvalue { float, float } %[[RESULT_TMP]], float %[[IMAG]], 1 |
| 269 |
// LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[A_ADDR]], align 4 |
| 270 |
// LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[B_ADDR]], align 4 |
| 271 |
|
| 272 |
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 |
| 273 |
// OGCG: %[[B_ADDR:.*]] = alloca { float, float }, align 4 |
| 274 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 275 |
// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 |
| 276 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 277 |
// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 |
| 278 |
// OGCG: %[[A_REAL_DEC:.*]] = fadd float %[[A_REAL]], -1.000000e+00 |
| 279 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 280 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 281 |
// OGCG: store float %[[A_REAL_DEC]], ptr %[[A_REAL_PTR]], align 4 |
| 282 |
// OGCG: store float %[[A_IMAG]], ptr %[[A_IMAG_PTR]], align 4 |
| 283 |
// OGCG: %[[RESULT_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 284 |
// OGCG: %[[RESULT_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 285 |
// OGCG: store float %[[A_REAL_DEC]], ptr %[[RESULT_REAL_PTR]], align 4 |
| 286 |
// OGCG: store float %[[A_IMAG]], ptr %[[RESULT_IMAG_PTR]], align 4 |
| 287 |
|
| 288 |
void foo7() { |
| 289 |
float _Complex a; |
| 290 |
float _Complex b = +a; |
| 291 |
} |
| 292 |
|
| 293 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 294 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 295 |
// CIR-BEFORE: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 296 |
// CIR-BEFORE: %[[COMPLEX_PLUS:.*]] = cir.unary(plus, %[[TMP]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 297 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_PLUS]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 298 |
|
| 299 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 300 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 301 |
// CIR-AFTER: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 302 |
// CIR-AFTER: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 303 |
// CIR-AFTER: %[[IMAG:.*]] = cir.complex.imag %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 304 |
// CIR-AFTER: %[[REAL_PLUS:.*]] = cir.unary(plus, %[[REAL]]) : !cir.float, !cir.float |
| 305 |
// CIR-AFTER: %[[IMAG_PLUS:.*]] = cir.unary(plus, %[[IMAG]]) : !cir.float, !cir.float |
| 306 |
// CIR-AFTER: %[[NEW_COMPLEX:.*]] = cir.complex.create %[[REAL_PLUS]], %[[IMAG_PLUS]] : !cir.float -> !cir.complex<!cir.float> |
| 307 |
// CIR-AFTER: cir.store{{.*}} %[[NEW_COMPLEX]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 308 |
|
| 309 |
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 310 |
// LLVM: %[[B_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 311 |
// LLVM: %[[TMP:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4 |
| 312 |
// LLVM: %[[REAL:.*]] = extractvalue { float, float } %[[TMP]], 0 |
| 313 |
// LLVM: %[[IMAG:.*]] = extractvalue { float, float } %[[TMP]], 1 |
| 314 |
// LLVM: %[[RESULT_TMP:.*]] = insertvalue { float, float } {{.*}}, float %[[REAL]], 0 |
| 315 |
// LLVM: %[[RESULT_VAL:.*]] = insertvalue { float, float } %[[RESULT_TMP]], float %[[IMAG]], 1 |
| 316 |
// LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[B_ADDR]], align 4 |
| 317 |
|
| 318 |
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 |
| 319 |
// OGCG: %[[B_ADDR:.*]] = alloca { float, float }, align 4 |
| 320 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 321 |
// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 |
| 322 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 323 |
// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 |
| 324 |
// OGCG: %[[B_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 325 |
// OGCG: %[[B_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 326 |
// OGCG: store float %[[A_REAL]], ptr %[[B_REAL_PTR]], align 4 |
| 327 |
// OGCG: store float %[[A_IMAG]], ptr %[[B_IMAG_PTR]], align 4 |
| 328 |
|
| 329 |
void foo8() { |
| 330 |
float _Complex a; |
| 331 |
float _Complex b = -a; |
| 332 |
} |
| 333 |
|
| 334 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 335 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 336 |
// CIR-BEFORE: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 337 |
// CIR-BEFORE: %[[COMPLEX_MINUS:.*]] = cir.unary(minus, %[[TMP]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 338 |
// CIR-BEFORE: cir.store{{.*}} %[[COMPLEX_MINUS]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 339 |
|
| 340 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 341 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["b", init] |
| 342 |
// CIR-AFTER: %[[TMP:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 343 |
// CIR-AFTER: %[[REAL:.*]] = cir.complex.real %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 344 |
// CIR-AFTER: %[[IMAG:.*]] = cir.complex.imag %[[TMP]] : !cir.complex<!cir.float> -> !cir.float |
| 345 |
// CIR-AFTER: %[[REAL_MINUS:.*]] = cir.unary(minus, %[[REAL]]) : !cir.float, !cir.float |
| 346 |
// CIR-AFTER: %[[IMAG_MINUS:.*]] = cir.unary(minus, %[[IMAG]]) : !cir.float, !cir.float |
| 347 |
// CIR-AFTER: %[[NEW_COMPLEX:.*]] = cir.complex.create %[[REAL_MINUS]], %[[IMAG_MINUS]] : !cir.float -> !cir.complex<!cir.float> |
| 348 |
// CIR-AFTER: cir.store{{.*}} %[[NEW_COMPLEX]], %[[B_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 349 |
|
| 350 |
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 351 |
// LLVM: %[[B_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 352 |
// LLVM: %[[TMP:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4 |
| 353 |
// LLVM: %[[REAL:.*]] = extractvalue { float, float } %[[TMP]], 0 |
| 354 |
// LLVM: %[[IMAG:.*]] = extractvalue { float, float } %[[TMP]], 1 |
| 355 |
// LLVM: %[[REAL_MINUS:.*]] = fneg float %[[REAL]] |
| 356 |
// LLVM: %[[IMAG_MINUS:.*]] = fneg float %[[IMAG]] |
| 357 |
// LLVM: %[[RESULT_TMP:.*]] = insertvalue { float, float } {{.*}}, float %[[REAL_MINUS]], 0 |
| 358 |
// LLVM: %[[RESULT_VAL:.*]] = insertvalue { float, float } %[[RESULT_TMP]], float %[[IMAG_MINUS]], 1 |
| 359 |
// LLVM: store { float, float } %[[RESULT_VAL]], ptr %[[B_ADDR]], align 4 |
| 360 |
|
| 361 |
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 |
| 362 |
// OGCG: %[[B_ADDR:.*]] = alloca { float, float }, align 4 |
| 363 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 364 |
// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 |
| 365 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 366 |
// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 |
| 367 |
// OGCG: %[[A_REAL_MINUS:.*]] = fneg float %[[A_REAL]] |
| 368 |
// OGCG: %[[A_IMAG_MINUS:.*]] = fneg float %[[A_IMAG]] |
| 369 |
// OGCG: %[[B_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 370 |
// OGCG: %[[B_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 371 |
// OGCG: store float %[[A_REAL_MINUS]], ptr %[[B_REAL_PTR]], align 4 |
| 372 |
// OGCG: store float %[[A_IMAG_MINUS]], ptr %[[B_IMAG_PTR]], align 4 |
| 373 |
|
| 374 |
void foo9() { |
| 375 |
_Float16 _Complex a; |
| 376 |
_Float16 _Complex b = +a; |
| 377 |
} |
| 378 |
|
| 379 |
|
| 380 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>>, ["a"] |
| 381 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>>, ["b", init] |
| 382 |
// CIR-BEFORE: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.f16>>, !cir.complex<!cir.f16> |
| 383 |
// CIR-BEFORE: %[[A_COMPLEX_F32:.*]] = cir.cast float_complex %[[TMP_A]] : !cir.complex<!cir.f16> -> !cir.complex<!cir.float> |
| 384 |
// CIR-BEFORE: %[[RESULT:.*]] = cir.unary(plus, %[[A_COMPLEX_F32]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 385 |
// CIR-BEFORE: %[[A_COMPLEX_F16:.*]] = cir.cast float_complex %[[RESULT]] : !cir.complex<!cir.float> -> !cir.complex<!cir.f16> |
| 386 |
// CIR-BEFORE: cir.store{{.*}} %[[A_COMPLEX_F16]], %[[B_ADDR]] : !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>> |
| 387 |
|
| 388 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>>, ["a"] |
| 389 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>>, ["b", init] |
| 390 |
// CIR-AFTER: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.f16>>, !cir.complex<!cir.f16> |
| 391 |
// CIR-AFTER: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex<!cir.f16> -> !cir.f16 |
| 392 |
// CIR-AFTER: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex<!cir.f16> -> !cir.f16 |
| 393 |
// CIR-AFTER: %[[A_REAL_F32:.*]] = cir.cast floating %[[A_REAL]] : !cir.f16 -> !cir.float |
| 394 |
// CIR-AFTER: %[[A_IMAG_F32:.*]] = cir.cast floating %[[A_IMAG]] : !cir.f16 -> !cir.float |
| 395 |
// CIR-AFTER: %[[A_COMPLEX_F32:.*]] = cir.complex.create %[[A_REAL_F32]], %[[A_IMAG_F32]] : !cir.float -> !cir.complex<!cir.float> |
| 396 |
// CIR-AFTER: %[[A_REAL_F32:.*]] = cir.complex.real %[[A_COMPLEX_F32]] : !cir.complex<!cir.float> -> !cir.float |
| 397 |
// CIR-AFTER: %[[A_IMAG_F32:.*]] = cir.complex.imag %[[A_COMPLEX_F32]] : !cir.complex<!cir.float> -> !cir.float |
| 398 |
// CIR-AFTER: %[[RESULT_REAL_F32:.*]] = cir.unary(plus, %[[A_REAL_F32]]) : !cir.float, !cir.float |
| 399 |
// CIR-AFTER: %[[RESULT_IMAG_F32:.*]] = cir.unary(plus, %[[A_IMAG_F32]]) : !cir.float, !cir.float |
| 400 |
// CIR-AFTER: %[[RESULT_COMPLEX_F32:.*]] = cir.complex.create %[[RESULT_REAL_F32]], %[[RESULT_IMAG_F32]] : !cir.float -> !cir.complex<!cir.float> |
| 401 |
// CIR-AFTER: %[[RESULT_REAL_F32:.*]] = cir.complex.real %[[RESULT_COMPLEX_F32]] : !cir.complex<!cir.float> -> !cir.float |
| 402 |
// CIR-AFTER: %[[RESULT_IMAG_F32:.*]] = cir.complex.imag %[[RESULT_COMPLEX_F32]] : !cir.complex<!cir.float> -> !cir.float |
| 403 |
// CIR-AFTER: %[[RESULT_REAL_F16:.*]] = cir.cast floating %[[RESULT_REAL_F32]] : !cir.float -> !cir.f16 |
| 404 |
// CIR-AFTER: %[[RESULT_IMAG_F16:.*]] = cir.cast floating %[[RESULT_IMAG_F32]] : !cir.float -> !cir.f16 |
| 405 |
// CIR-AFTER: %[[RESULT_COMPLEX_F16:.*]] = cir.complex.create %[[RESULT_REAL_F16]], %[[RESULT_IMAG_F16]] : !cir.f16 -> !cir.complex<!cir.f16> |
| 406 |
// CIR-AFTER: cir.store{{.*}} %[[RESULT_COMPLEX_F16]], %[[B_ADDR]] : !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>> |
| 407 |
|
| 408 |
// LLVM: %[[A_ADDR:.*]] = alloca { half, half }, i64 1, align 2 |
| 409 |
// LLVM: %[[B_ADDR:.*]] = alloca { half, half }, i64 1, align 2 |
| 410 |
// LLVM: %[[TMP_A:.*]] = load { half, half }, ptr %[[A_ADDR]], align 2 |
| 411 |
// LLVM: %[[A_REAL:.*]] = extractvalue { half, half } %[[TMP_A]], 0 |
| 412 |
// LLVM: %[[A_IMAG:.*]] = extractvalue { half, half } %[[TMP_A]], 1 |
| 413 |
// LLVM: %[[A_REAL_F32:.*]] = fpext half %[[A_REAL]] to float |
| 414 |
// LLVM: %[[A_IMAG_F32:.*]] = fpext half %[[A_IMAG]] to float |
| 415 |
// LLVM: %[[TMP_A_COMPLEX_F32:.*]] = insertvalue { float, float } {{.*}}, float %[[A_REAL_F32]], 0 |
| 416 |
// LLVM: %[[A_COMPLEX_F32:.*]] = insertvalue { float, float } %[[TMP_A_COMPLEX_F32]], float %[[A_IMAG_F32]], 1 |
| 417 |
// LLVM: %[[TMP_A_COMPLEX_F32:.*]] = insertvalue { float, float } {{.*}}, float %[[A_REAL_F32]], 0 |
| 418 |
// LLVM: %[[A_COMPLEX_F32:.*]] = insertvalue { float, float } %[[TMP_A_COMPLEX_F32]], float %[[A_IMAG_F32]], 1 |
| 419 |
// LLVM: %[[A_REAL_F16:.*]] = fptrunc float %[[A_REAL_F32]] to half |
| 420 |
// LLVM: %[[A_IMAG_F16:.*]] = fptrunc float %[[A_IMAG_F32]] to half |
| 421 |
// LLVM: %[[TMP_RESULT_COMPLEX_F16:.*]] = insertvalue { half, half } {{.*}}, half %[[A_REAL_F16]], 0 |
| 422 |
// LLVM: %[[RESULT_COMPLEX_F16:.*]] = insertvalue { half, half } %[[TMP_RESULT_COMPLEX_F16]], half %[[A_IMAG_F16]], 1 |
| 423 |
// LLVM: store { half, half } %[[RESULT_COMPLEX_F16]], ptr %[[B_ADDR]], align 2 |
| 424 |
|
| 425 |
// OGCG: %[[A_ADDR:.*]] = alloca { half, half }, align 2 |
| 426 |
// OGCG: %[[B_ADDR:.*]] = alloca { half, half }, align 2 |
| 427 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { half, half }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 428 |
// OGCG: %[[A_REAL:.*]] = load half, ptr %a.realp, align 2 |
| 429 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { half, half }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 430 |
// OGCG: %[[A_IMAG:.*]] = load half, ptr %a.imagp, align 2 |
| 431 |
// OGCG: %[[A_REAL_F32:.*]] = fpext half %[[A_REAL]] to float |
| 432 |
// OGCG: %[[A_IMAG_F32:.*]] = fpext half %[[A_IMAG]] to float |
| 433 |
// OGCG: %[[RESULT_REAL:.*]] = fptrunc float %[[A_REAL_F32]] to half |
| 434 |
// OGCG: %[[RESULT_IMAG:.*]] = fptrunc float %[[A_IMAG_F32]] to half |
| 435 |
// OGCG: %[[B_REAL_PTR:.*]] = getelementptr inbounds nuw { half, half }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 436 |
// OGCG: %[[B_IMAG_PTR:.*]] = getelementptr inbounds nuw { half, half }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 437 |
// OGCG: store half %[[RESULT_REAL]], ptr %[[B_REAL_PTR]], align 2 |
| 438 |
// OGCG: store half %[[RESULT_IMAG]], ptr %[[B_IMAG_PTR]], align 2 |
| 439 |
|
| 440 |
void foo10() { |
| 441 |
_Float16 _Complex a; |
| 442 |
_Float16 _Complex b = -a; |
| 443 |
} |
| 444 |
|
| 445 |
// CIR-BEFORE: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>>, ["a"] |
| 446 |
// CIR-BEFORE: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>>, ["b", init] |
| 447 |
// CIR-BEFORE: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.f16>>, !cir.complex<!cir.f16> |
| 448 |
// CIR-BEFORE: %[[A_COMPLEX_F32:.*]] = cir.cast float_complex %[[TMP_A]] : !cir.complex<!cir.f16> -> !cir.complex<!cir.float> |
| 449 |
// CIR-BEFORE: %[[RESULT:.*]] = cir.unary(minus, %[[A_COMPLEX_F32]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 450 |
// CIR-BEFORE: %[[A_COMPLEX_F16:.*]] = cir.cast float_complex %[[RESULT]] : !cir.complex<!cir.float> -> !cir.complex<!cir.f16> |
| 451 |
// CIR-BEFORE: cir.store{{.*}} %[[A_COMPLEX_F16]], %[[B_ADDR]] : !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>> |
| 452 |
|
| 453 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>>, ["a"] |
| 454 |
// CIR-AFTER: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>>, ["b", init] |
| 455 |
// CIR-AFTER: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.f16>>, !cir.complex<!cir.f16> |
| 456 |
// CIR-AFTER: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex<!cir.f16> -> !cir.f16 |
| 457 |
// CIR-AFTER: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex<!cir.f16> -> !cir.f16 |
| 458 |
// CIR-AFTER: %[[A_REAL_F32:.*]] = cir.cast floating %[[A_REAL]] : !cir.f16 -> !cir.float |
| 459 |
// CIR-AFTER: %[[A_IMAG_F32:.*]] = cir.cast floating %[[A_IMAG]] : !cir.f16 -> !cir.float |
| 460 |
// CIR-AFTER: %[[A_COMPLEX_F32:.*]] = cir.complex.create %[[A_REAL_F32]], %[[A_IMAG_F32]] : !cir.float -> !cir.complex<!cir.float> |
| 461 |
// CIR-AFTER: %[[A_REAL_F32:.*]] = cir.complex.real %[[A_COMPLEX_F32]] : !cir.complex<!cir.float> -> !cir.float |
| 462 |
// CIR-AFTER: %[[A_IMAG_F32:.*]] = cir.complex.imag %[[A_COMPLEX_F32]] : !cir.complex<!cir.float> -> !cir.float |
| 463 |
// CIR-AFTER: %[[RESULT_REAL_F32:.*]] = cir.unary(minus, %[[A_REAL_F32]]) : !cir.float, !cir.float |
| 464 |
// CIR-AFTER: %[[RESULT_IMAG_F32:.*]] = cir.unary(minus, %[[A_IMAG_F32]]) : !cir.float, !cir.float |
| 465 |
// CIR-AFTER: %[[RESULT_COMPLEX_F32:.*]] = cir.complex.create %[[RESULT_REAL_F32]], %[[RESULT_IMAG_F32]] : !cir.float -> !cir.complex<!cir.float> |
| 466 |
// CIR-AFTER: %[[RESULT_REAL_F32:.*]] = cir.complex.real %[[RESULT_COMPLEX_F32]] : !cir.complex<!cir.float> -> !cir.float |
| 467 |
// CIR-AFTER: %[[RESULT_IMAG_F32:.*]] = cir.complex.imag %[[RESULT_COMPLEX_F32]] : !cir.complex<!cir.float> -> !cir.float |
| 468 |
// CIR-AFTER: %[[RESULT_REAL_F16:.*]] = cir.cast floating %[[RESULT_REAL_F32]] : !cir.float -> !cir.f16 |
| 469 |
// CIR-AFTER: %[[RESULT_IMAG_F16:.*]] = cir.cast floating %[[RESULT_IMAG_F32]] : !cir.float -> !cir.f16 |
| 470 |
// CIR-AFTER: %[[RESULT_COMPLEX_F16:.*]] = cir.complex.create %[[RESULT_REAL_F16]], %[[RESULT_IMAG_F16]] : !cir.f16 -> !cir.complex<!cir.f16> |
| 471 |
// CIR-AFTER: cir.store{{.*}} %[[RESULT_COMPLEX_F16]], %[[B_ADDR]] : !cir.complex<!cir.f16>, !cir.ptr<!cir.complex<!cir.f16>> |
| 472 |
|
| 473 |
// LLVM: %[[A_ADDR:.*]] = alloca { half, half }, i64 1, align 2 |
| 474 |
// LLVM: %[[B_ADDR:.*]] = alloca { half, half }, i64 1, align 2 |
| 475 |
// LLVM: %[[TMP_A:.*]] = load { half, half }, ptr %[[A_ADDR]], align 2 |
| 476 |
// LLVM: %[[A_REAL:.*]] = extractvalue { half, half } %[[TMP_A]], 0 |
| 477 |
// LLVM: %[[A_IMAG:.*]] = extractvalue { half, half } %[[TMP_A]], 1 |
| 478 |
// LLVM: %[[A_REAL_F32:.*]] = fpext half %[[A_REAL]] to float |
| 479 |
// LLVM: %[[A_IMAG_F32:.*]] = fpext half %[[A_IMAG]] to float |
| 480 |
// LLVM: %[[TMP_A_COMPLEX_F32:.*]] = insertvalue { float, float } {{.*}}, float %[[A_REAL_F32]], 0 |
| 481 |
// LLVM: %[[A_COMPLEX_F32:.*]] = insertvalue { float, float } %[[TMP_A_COMPLEX_F32]], float %[[A_IMAG_F32]], 1 |
| 482 |
// LLVM: %[[RESULT_REAL_F32:.*]] = fneg float %[[A_REAL_F32]] |
| 483 |
// LLVM: %[[RESULT_IMAG_F32:.*]] = fneg float %[[A_IMAG_F32]] |
| 484 |
// LLVM: %[[TMP_A_COMPLEX_F32:.*]] = insertvalue { float, float } {{.*}}, float %[[RESULT_REAL_F32]], 0 |
| 485 |
// LLVM: %[[A_COMPLEX_F32:.*]] = insertvalue { float, float } %[[TMP_A_COMPLEX_F32]], float %[[RESULT_IMAG_F32]], 1 |
| 486 |
// LLVM: %[[A_REAL_F16:.*]] = fptrunc float %[[RESULT_REAL_F32]] to half |
| 487 |
// LLVM: %[[A_IMAG_F16:.*]] = fptrunc float %[[RESULT_IMAG_F32]] to half |
| 488 |
// LLVM: %[[TMP_RESULT_COMPLEX_F16:.*]] = insertvalue { half, half } {{.*}}, half %[[A_REAL_F16]], 0 |
| 489 |
// LLVM: %[[RESULT_COMPLEX_F16:.*]] = insertvalue { half, half } %[[TMP_RESULT_COMPLEX_F16]], half %[[A_IMAG_F16]], 1 |
| 490 |
// LLVM: store { half, half } %[[RESULT_COMPLEX_F16]], ptr %[[B_ADDR]], align 2 |
| 491 |
|
| 492 |
// OGCG: %[[A_ADDR:.*]] = alloca { half, half }, align 2 |
| 493 |
// OGCG: %[[B_ADDR:.*]] = alloca { half, half }, align 2 |
| 494 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { half, half }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 495 |
// OGCG: %[[A_REAL:.*]] = load half, ptr %a.realp, align 2 |
| 496 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { half, half }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 497 |
// OGCG: %[[A_IMAG:.*]] = load half, ptr %a.imagp, align 2 |
| 498 |
// OGCG: %[[A_REAL_F32:.*]] = fpext half %[[A_REAL]] to float |
| 499 |
// OGCG: %[[A_IMAG_F32:.*]] = fpext half %[[A_IMAG]] to float |
| 500 |
// OGCG: %[[RESULT_REAL_F32:.*]] = fneg float %[[A_REAL_F32]] |
| 501 |
// OGCG: %[[RESULT_IMAG_F32:.*]] = fneg float %[[A_IMAG_F32]] |
| 502 |
// OGCG: %[[RESULT_REAL:.*]] = fptrunc float %[[RESULT_REAL_F32]] to half |
| 503 |
// OGCG: %[[RESULT_IMAG:.*]] = fptrunc float %[[RESULT_IMAG_F32]] to half |
| 504 |
// OGCG: %[[B_REAL_PTR:.*]] = getelementptr inbounds nuw { half, half }, ptr %[[B_ADDR]], i32 0, i32 0 |
| 505 |
// OGCG: %[[B_IMAG_PTR:.*]] = getelementptr inbounds nuw { half, half }, ptr %[[B_ADDR]], i32 0, i32 1 |
| 506 |
// OGCG: store half %[[RESULT_REAL]], ptr %[[B_REAL_PTR]], align 2 |
| 507 |
// OGCG: store half %[[RESULT_IMAG]], ptr %[[B_IMAG_PTR]], align 2 |
| 508 |
|
| 509 |
void complex_unary_inc_lvalue() { |
| 510 |
float _Complex a; |
| 511 |
++a; |
| 512 |
} |
| 513 |
|
| 514 |
|
| 515 |
// CIR-BEFORE: %[[A_ADDR]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 516 |
// CIR-BEFORE: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 517 |
// CIR-BEFORE: %[[RESULT:.*]] = cir.unary(inc, %[[TMP_A]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 518 |
// CIR-BEFORE: cir.store{{.*}} %[[RESULT]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 519 |
|
| 520 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 521 |
// CIR-AFTER: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 522 |
// CIR-AFTER: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex<!cir.float> -> !cir.float |
| 523 |
// CIR-AFTER: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex<!cir.float> -> !cir.float |
| 524 |
// CIR-AFTER: %[[RESULT_REAL:.*]] = cir.unary(inc, %2) : !cir.float, !cir.float |
| 525 |
// CIR-AFTER: %[[RESULT:.*]] = cir.complex.create %[[RESULT_REAL]], %[[A_IMAG]] : !cir.float -> !cir.complex<!cir.float> |
| 526 |
// CIR-AFTER: cir.store{{.*}} %[[RESULT]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 527 |
|
| 528 |
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 529 |
// LLVM: %[[TMP_A:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4 |
| 530 |
// LLVM: %[[A_REAL:.*]] = extractvalue { float, float } %[[TMP_A]], 0 |
| 531 |
// LLVM: %[[A_IMAG:.*]] = extractvalue { float, float } %[[TMP_A]], 1 |
| 532 |
// LLVM: %[[RESULT_REAL:.*]] = fadd float 1.000000e+00, %[[A_REAL]] |
| 533 |
// LLVM: %[[TMP_RESULT:.*]] = insertvalue { float, float } {{.*}}, float %[[RESULT_REAL]], 0 |
| 534 |
// LLVM: %[[RESULT:.*]] = insertvalue { float, float } %[[TMP_RESULT]], float %[[A_IMAG]], 1 |
| 535 |
// LLVM: store { float, float } %[[RESULT]], ptr %[[A_ADDR]], align 4 |
| 536 |
|
| 537 |
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 |
| 538 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 539 |
// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 |
| 540 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 541 |
// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 |
| 542 |
// OGCG: %[[RESULT_REAL:.*]] = fadd float %[[A_REAL]], 1.000000e+00 |
| 543 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 544 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 545 |
// OGCG: store float %[[RESULT_REAL]], ptr %[[A_REAL_PTR]], align 4 |
| 546 |
// OGCG: store float %[[A_IMAG]], ptr %[[A_IMAG_PTR]], align 4 |
| 547 |
|
| 548 |
void complex_unary_dec_lvalue() { |
| 549 |
float _Complex a; |
| 550 |
--a; |
| 551 |
} |
| 552 |
|
| 553 |
// CIR-BEFORE: %[[A_ADDR]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 554 |
// CIR-BEFORE: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 555 |
// CIR-BEFORE: %[[RESULT:.*]] = cir.unary(dec, %[[TMP_A]]) : !cir.complex<!cir.float>, !cir.complex<!cir.float> |
| 556 |
// CIR-BEFORE: cir.store{{.*}} %[[RESULT]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 557 |
|
| 558 |
// CIR-AFTER: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"] |
| 559 |
// CIR-AFTER: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float> |
| 560 |
// CIR-AFTER: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex<!cir.float> -> !cir.float |
| 561 |
// CIR-AFTER: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex<!cir.float> -> !cir.float |
| 562 |
// CIR-AFTER: %[[RESULT_REAL:.*]] = cir.unary(dec, %2) : !cir.float, !cir.float |
| 563 |
// CIR-AFTER: %[[RESULT:.*]] = cir.complex.create %[[RESULT_REAL]], %[[A_IMAG]] : !cir.float -> !cir.complex<!cir.float> |
| 564 |
// CIR-AFTER: cir.store{{.*}} %[[RESULT]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> |
| 565 |
|
| 566 |
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 |
| 567 |
// LLVM: %[[TMP_A:.*]] = load { float, float }, ptr %[[A_ADDR]], align 4 |
| 568 |
// LLVM: %[[A_REAL:.*]] = extractvalue { float, float } %[[TMP_A]], 0 |
| 569 |
// LLVM: %[[A_IMAG:.*]] = extractvalue { float, float } %[[TMP_A]], 1 |
| 570 |
// LLVM: %[[RESULT_REAL:.*]] = fadd float -1.000000e+00, %[[A_REAL]] |
| 571 |
// LLVM: %[[TMP_RESULT:.*]] = insertvalue { float, float } {{.*}}, float %[[RESULT_REAL]], 0 |
| 572 |
// LLVM: %[[RESULT:.*]] = insertvalue { float, float } %[[TMP_RESULT]], float %[[A_IMAG]], 1 |
| 573 |
// LLVM: store { float, float } %[[RESULT]], ptr %[[A_ADDR]], align 4 |
| 574 |
|
| 575 |
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 |
| 576 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 577 |
// OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 |
| 578 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 579 |
// OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 |
| 580 |
// OGCG: %[[RESULT_REAL:.*]] = fadd float %[[A_REAL]], -1.000000e+00 |
| 581 |
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 |
| 582 |
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 |
| 583 |
// OGCG: store float %[[RESULT_REAL]], ptr %[[A_REAL_PTR]], align 4 |
| 584 |
// OGCG: store float %[[A_IMAG]], ptr %[[A_IMAG_PTR]], align 4 |