1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fenable-matrix -emit-llvm -disable-llvm-optzns -o - %s | FileCheck %s
4 __attribute__((objc_root_class))
9 typedef double double4x4 __attribute__((matrix_type(4, 4)));
11 // Check that we correctly deal with placeholder expressions.
13 // CHECK-LABEL: @test_index_placeholders(
15 // CHECK: [[IV:%.*]] = load ptr, ptr [[IV_ADDR:%.*]], align 8
16 // CHECK-NEXT: [[SEL:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8, !invariant.load !7
17 // CHECK-NEXT: [[CALL:%.*]] = call i32 @objc_msgSend(ptr noundef [[IV]], ptr noundef [[SEL]])
18 // CHECK-NEXT: [[CONV:%.*]] = sext i32 [[CALL]] to i64
19 // CHECK-NEXT: [[IV2:%.*]] = load ptr, ptr [[IV_ADDR]], align 8
20 // CHECK-NEXT: [[SEL2:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8, !invariant.load !7
21 // CHECK-NEXT: [[CALL1:%.*]] = call i32 @objc_msgSend(ptr noundef [[IV2]], ptr noundef [[SEL2]])
22 // CHECK-NEXT: [[CONV2:%.*]] = sext i32 [[CALL1]] to i64
23 // CHECK-NEXT: [[IDX1:%.*]] = mul i64 [[CONV2]], 4
24 // CHECK-NEXT: [[IDX2:%.*]] = add i64 [[IDX1]], [[CONV]]
25 // CHECK-NEXT: [[MAT:%.*]] = load <16 x double>, ptr {{.*}} align 8
26 // CHECK-NEXT: [[MATEXT:%.*]] = extractelement <16 x double> [[MAT]], i64 [[IDX2]]
27 // CHECK-NEXT: ret double [[MATEXT]]
29 double test_index_placeholders(double4x4 m, IntValue *iv) {
31 return m[iv.value][iv.value];
34 __attribute__((objc_root_class))
35 @interface MatrixValue
36 @property double4x4 value;
39 // CHECK-LABEL: @test_base_and_index_placeholders(
40 // CHECK: [[IV:%.*]] = load ptr, ptr [[IV_ADDR:%.*]], align 8
41 // CHECK-NEXT: [[SEL:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8, !invariant.load !7
42 // CHECK-NEXT: [[CALL:%.*]] = call i32 @objc_msgSend(ptr noundef [[IV]], ptr noundef [[SEL]])
43 // CHECK-NEXT: [[CONV:%.*]] = sext i32 [[CALL]] to i64
44 // CHECK-NEXT: [[IV2:%.*]] = load ptr, ptr [[IV_ADDR]], align 8
45 // CHECK-NEXT: [[SEL2:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8, !invariant.load !7
46 // CHECK-NEXT: [[CALL1:%.*]] = call i32 @objc_msgSend(ptr noundef [[IV2]], ptr noundef [[SEL2]])
47 // CHECK-NEXT: [[CONV2:%.*]] = sext i32 [[CALL1]] to i64
48 // CHECK-NEXT: [[IDX1:%.*]] = mul i64 [[CONV2]], 4
49 // CHECK-NEXT: [[IDX2:%.*]] = add i64 [[IDX1]], [[CONV]]
50 // CHECK-NEXT: [[M:%.*]] = load ptr, ptr %m.addr, align 8
51 // CHECK-NEXT: [[SEL3:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8, !invariant.load !7
52 // CHECK-NEXT: [[MAT:%.*]] = call <16 x double> @objc_msgSend(ptr noundef [[M]], ptr noundef [[SEL3]])
53 // CHECK-NEXT: [[MATEXT:%.*]] = extractelement <16 x double> [[MAT]], i64 [[IDX2]]
54 // CHECK-NEXT: ret double [[MATEXT]]
56 double test_base_and_index_placeholders(MatrixValue *m, IntValue *iv) {
58 return m.value[iv.value][iv.value];