brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 17171d3 Raw
97 lines · c
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir2// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR3// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll4// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM5// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll6// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG7 8struct S {9  char b;10  short s;11  int i;12  float f;13  double d;14};15 16void accessStruct(struct S u) {17  u.b;18  u.s;19  u.i;20  u.f;21  u.d;22}23 24// CIR: cir.func{{.*}} @accessStruct25// CIR:   cir.load align(8)26// CIR:   cir.load align(2)27// CIR:   cir.load align(4)28// CIR:   cir.load align(8)29// CIR:   cir.load align(8)30 31// LLVM: define{{.*}} @accessStruct32// LLVM:   load i8, ptr {{.*}}, align 833// LLVM:   load i16, ptr {{.*}}, align 234// LLVM:   load i32, ptr {{.*}}, align 435// LLVM:   load float, ptr {{.*}}, align 836// LLVM:   load double, ptr {{.*}}, align 837 38// OGCG: define{{.*}} @accessStruct39// OGCG:   load i8, ptr {{.*}}, align 840// OGCG:   load i16, ptr {{.*}}, align 241// OGCG:   load i32, ptr {{.*}}, align 442// OGCG:   load float, ptr {{.*}}, align 843// OGCG:   load double, ptr {{.*}}, align 844 45union U {46  char b;47  short s;48  int i;49  float f;50  double d;51};52 53void accessUnion(union U u) {54  u.b;55  u.s;56  u.i;57  u.f;58  u.d;59}60 61// CIR: cir.func{{.*}} @accessUnion62// CIR:   cir.load align(8)63// CIR:   cir.load align(8)64// CIR:   cir.load align(8)65// CIR:   cir.load align(8)66// CIR:   cir.load align(8)67 68// LLVM: define{{.*}} @accessUnion69// LLVM:   load i8, ptr {{.*}}, align 870// LLVM:   load i16, ptr {{.*}}, align 871// LLVM:   load i32, ptr {{.*}}, align 872// LLVM:   load float, ptr {{.*}}, align 873// LLVM:   load double, ptr {{.*}}, align 874 75// OGCG: define{{.*}} @accessUnion76// OGCG:   load i8, ptr {{.*}}, align 877// OGCG:   load i16, ptr {{.*}}, align 878// OGCG:   load i32, ptr {{.*}}, align 879// OGCG:   load float, ptr {{.*}}, align 880// OGCG:   load double, ptr {{.*}}, align 881 82// PR5279 - Reduced alignment on typedef.83typedef int myint __attribute__((aligned(1)));84 85int loadAligned(myint *p) {86  return *p;87}88 89// CIR: cir.func{{.*}} @loadAligned90// CIR:   cir.load align(1)91 92// LLVM: @loadAligned93// LLVM:   load i32, ptr {{.*}}, align 194 95// OGCG: @loadAligned96// OGCG:   load i32, ptr {{.*}}, align 197