• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2 
3 typedef double * __attribute__((align_value(64))) aligned_double;
4 
foo(aligned_double x,double * y,double & z)5 void foo(aligned_double x, double * y __attribute__((align_value(32))),
6          double & z __attribute__((align_value(128)))) { };
7 // CHECK: define void @_Z3fooPdS_Rd(double* align 64 %x, double* align 32 %y, double* align 128 dereferenceable(8) %z)
8 
9 struct ad_struct {
10   aligned_double a;
11 };
12 
foo(ad_struct & x)13 double *foo(ad_struct& x) {
14 // CHECK-LABEL: @_Z3fooR9ad_struct
15 
16 // CHECK: [[PTRINT1:%.+]] = ptrtoint
17 // CHECK: [[MASKEDPTR1:%.+]] = and i64 [[PTRINT1]], 63
18 // CHECK: [[MASKCOND1:%.+]] = icmp eq i64 [[MASKEDPTR1]], 0
19 // CHECK: call void @llvm.assume(i1 [[MASKCOND1]])
20   return x.a;
21 }
22 
goo(ad_struct * x)23 double *goo(ad_struct *x) {
24 // CHECK-LABEL: @_Z3gooP9ad_struct
25 
26 // CHECK: [[PTRINT2:%.+]] = ptrtoint
27 // CHECK: [[MASKEDPTR2:%.+]] = and i64 [[PTRINT2]], 63
28 // CHECK: [[MASKCOND2:%.+]] = icmp eq i64 [[MASKEDPTR2]], 0
29 // CHECK: call void @llvm.assume(i1 [[MASKCOND2]])
30   return x->a;
31 }
32 
bar(aligned_double * x)33 double *bar(aligned_double *x) {
34 // CHECK-LABEL: @_Z3barPPd
35 
36 // CHECK: [[PTRINT3:%.+]] = ptrtoint
37 // CHECK: [[MASKEDPTR3:%.+]] = and i64 [[PTRINT3]], 63
38 // CHECK: [[MASKCOND3:%.+]] = icmp eq i64 [[MASKEDPTR3]], 0
39 // CHECK: call void @llvm.assume(i1 [[MASKCOND3]])
40   return *x;
41 }
42 
car(aligned_double & x)43 double *car(aligned_double &x) {
44 // CHECK-LABEL: @_Z3carRPd
45 
46 // CHECK: [[PTRINT4:%.+]] = ptrtoint
47 // CHECK: [[MASKEDPTR4:%.+]] = and i64 [[PTRINT4]], 63
48 // CHECK: [[MASKCOND4:%.+]] = icmp eq i64 [[MASKEDPTR4]], 0
49 // CHECK: call void @llvm.assume(i1 [[MASKCOND4]])
50   return x;
51 }
52 
dar(aligned_double * x)53 double *dar(aligned_double *x) {
54 // CHECK-LABEL: @_Z3darPPd
55 
56 // CHECK: [[PTRINT5:%.+]] = ptrtoint
57 // CHECK: [[MASKEDPTR5:%.+]] = and i64 [[PTRINT5]], 63
58 // CHECK: [[MASKCOND5:%.+]] = icmp eq i64 [[MASKEDPTR5]], 0
59 // CHECK: call void @llvm.assume(i1 [[MASKCOND5]])
60   return x[5];
61 }
62 
63 aligned_double eep();
ret()64 double *ret() {
65 // CHECK-LABEL: @_Z3retv
66 
67 // CHECK: [[PTRINT6:%.+]] = ptrtoint
68 // CHECK: [[MASKEDPTR6:%.+]] = and i64 [[PTRINT6]], 63
69 // CHECK: [[MASKCOND6:%.+]] = icmp eq i64 [[MASKEDPTR6]], 0
70 // CHECK: call void @llvm.assume(i1 [[MASKCOND6]])
71   return eep();
72 }
73 
no1(aligned_double * x)74 double **no1(aligned_double *x) {
75 // CHECK-LABEL: @_Z3no1PPd
76   return x;
77 // CHECK-NOT: call void @llvm.assume
78 }
79 
no2(aligned_double & x)80 double *&no2(aligned_double &x) {
81 // CHECK-LABEL: @_Z3no2RPd
82   return x;
83 // CHECK-NOT: call void @llvm.assume
84 }
85 
no3(aligned_double & x)86 double **no3(aligned_double &x) {
87 // CHECK-LABEL: @_Z3no3RPd
88   return &x;
89 // CHECK-NOT: call void @llvm.assume
90 }
91 
no3(aligned_double x)92 double no3(aligned_double x) {
93 // CHECK-LABEL: @_Z3no3Pd
94   return *x;
95 // CHECK-NOT: call void @llvm.assume
96 }
97 
no4(aligned_double x)98 double *no4(aligned_double x) {
99 // CHECK-LABEL: @_Z3no4Pd
100   return x;
101 // CHECK-NOT: call void @llvm.assume
102 }
103 
104