Debian Codegraph @

clang/test/CodeGenObjC/matrix-type-operators.m

raw
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
3
4 __attribute__((objc_root_class))
5 @interface IntValue
6 @property int value;
7 @end
8
9 typedef double double4x4 __attribute__((matrix_type(4, 4)));
10
11 // Check that we correctly deal with placeholder expressions.
12
13 // CHECK-LABEL: @test_index_placeholders(
14 // CHECK-NEXT: entry:
15 // CHECK: [[IV:%.*]] = load ptr, ptr [[IV_ADDR:%.*]], align 8
16 // CHECK-NEXT: [[SEL:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8, !invariant.load !{{[0-9]+}}
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 !{{[0-9]+}}
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]]
28 //
29 double test_index_placeholders(double4x4 m, IntValue *iv) {
30
31 return m[iv.value][iv.value];
32 }
33
34 __attribute__((objc_root_class))
35 @interface MatrixValue
36 @property double4x4 value;
37 @end
38
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 !{{[0-9]+}}
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 !{{[0-9]+}}
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 !{{[0-9]+}}
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]]
55 //
56 double test_base_and_index_placeholders(MatrixValue *m, IntValue *iv) {
57
58 return m.value[iv.value][iv.value];
59 }