brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · 04bf406 Raw
88 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -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 8int compound_assign(int b) {9  int x = 1;10  x *= b;11  x /= b;12  x %= b;13  x += b;14  x -= b;15  x >>= b;16  x <<= b;17  x &= b;18  x ^= b;19  x |= b;20  return x;21}22 23// CIR: cir.func{{.*}} @_Z15compound_assigni24// CIR:   %[[MUL:.*]] = cir.binop(mul, %{{.*}}, %{{.*}}) nsw : !s32i25// CIR:   cir.store{{.*}} %[[MUL]], %{{.*}} : !s32i, !cir.ptr<!s32i>26// CIR:   %[[DIV:.*]] = cir.binop(div, %{{.*}}, %{{.*}}) : !s32i27// CIR:   cir.store{{.*}} %[[DIV]], %{{.*}} : !s32i, !cir.ptr<!s32i>28// CIR:   %[[REM:.*]] = cir.binop(rem, %{{.*}}, %{{.*}}) : !s32i29// CIR:   cir.store{{.*}} %[[REM]], %{{.*}} : !s32i, !cir.ptr<!s32i>30// CIR:   %[[ADD:.*]] = cir.binop(add, %{{.*}}, %{{.*}}) nsw : !s32i31// CIR:   cir.store{{.*}} %[[ADD]], %{{.*}} : !s32i, !cir.ptr<!s32i>32// CIR:   %[[SUB:.*]] = cir.binop(sub, %{{.*}}, %{{.*}}) nsw : !s32i33// CIR:   cir.store{{.*}} %[[SUB]], %{{.*}} : !s32i, !cir.ptr<!s32i>34// CIR:   %[[SHR:.*]] = cir.shift(right, %{{.*}} : !s32i, %{{.*}} : !s32i) -> !s32i35// CIR:   cir.store{{.*}} %[[SHR]], %{{.*}} : !s32i, !cir.ptr<!s32i>36// CIR:   %[[SHL:.*]] = cir.shift(left, %{{.*}} : !s32i, %{{.*}} : !s32i) -> !s32i37// CIR:   cir.store{{.*}} %[[SHL]], %{{.*}} : !s32i, !cir.ptr<!s32i>38// CIR:   %[[AND:.*]] = cir.binop(and, %{{.*}}, %{{.*}}) : !s32i39// CIR:   cir.store{{.*}} %[[AND]], %{{.*}} : !s32i, !cir.ptr<!s32i>40// CIR:   %[[XOR:.*]] = cir.binop(xor, %{{.*}}, %{{.*}}) : !s32i41// CIR:   cir.store{{.*}} %[[XOR]], %{{.*}} : !s32i, !cir.ptr<!s32i>42// CIR:   %[[OR:.*]] = cir.binop(or, %{{.*}}, %{{.*}}) : !s32i43// CIR:   cir.store{{.*}} %[[OR]], %{{.*}} : !s32i, !cir.ptr<!s32i>44 45// LLVM: define {{.*}}i32 @_Z15compound_assigni46// LLVM:   %[[MUL:.*]] = mul nsw i32 %{{.*}}, %{{.*}}47// LLVM:   store i32 %[[MUL]], ptr %{{.*}}48// LLVM:   %[[DIV:.*]] = sdiv i32 %{{.*}}, %{{.*}}49// LLVM:   store i32 %[[DIV]], ptr %{{.*}}50// LLVM:   %[[REM:.*]] = srem i32 %{{.*}}, %{{.*}}51// LLVM:   store i32 %[[REM]], ptr %{{.*}}52// LLVM:   %[[ADD:.*]] = add nsw i32 %{{.*}}, %{{.*}}53// LLVM:   store i32 %[[ADD]], ptr %{{.*}}54// LLVM:   %[[SUB:.*]] = sub nsw i32 %{{.*}}, %{{.*}}55// LLVM:   store i32 %[[SUB]], ptr %{{.*}}56// LLVM:   %[[SHR:.*]] = ashr i32 %{{.*}}, %{{.*}}57// LLVM:   store i32 %[[SHR]], ptr %{{.*}}58// LLVM:   %[[SHL:.*]] = shl i32 %{{.*}}, %{{.*}}59// LLVM:   store i32 %[[SHL]], ptr %{{.*}}60// LLVM:   %[[AND:.*]] = and i32 %{{.*}}, %{{.*}}61// LLVM:   store i32 %[[AND]], ptr %{{.*}}62// LLVM:   %[[XOR:.*]] = xor i32 %{{.*}}, %{{.*}}63// LLVM:   store i32 %[[XOR]], ptr %{{.*}}64// LLVM:   %[[OR:.*]] = or i32 %{{.*}}, %{{.*}}65// LLVM:   store i32 %[[OR]], ptr %{{.*}}66 67// OGCG: define {{.*}}i32 @_Z15compound_assigni68// OGCG:   %[[MUL:.*]] = mul nsw i32 %{{.*}}, %{{.*}}69// OGCG:   store i32 %[[MUL]], ptr %{{.*}}70// OGCG:   %[[DIV:.*]] = sdiv i32 %{{.*}}, %{{.*}}71// OGCG:   store i32 %[[DIV]], ptr %{{.*}}72// OGCG:   %[[REM:.*]] = srem i32 %{{.*}}, %{{.*}}73// OGCG:   store i32 %[[REM]], ptr %{{.*}}74// OGCG:   %[[ADD:.*]] = add nsw i32 %{{.*}}, %{{.*}}75// OGCG:   store i32 %[[ADD]], ptr %{{.*}}76// OGCG:   %[[SUB:.*]] = sub nsw i32 %{{.*}}, %{{.*}}77// OGCG:   store i32 %[[SUB]], ptr %{{.*}}78// OGCG:   %[[SHR:.*]] = ashr i32 %{{.*}}, %{{.*}}79// OGCG:   store i32 %[[SHR]], ptr %{{.*}}80// OGCG:   %[[SHL:.*]] = shl i32 %{{.*}}, %{{.*}}81// OGCG:   store i32 %[[SHL]], ptr %{{.*}}82// OGCG:   %[[AND:.*]] = and i32 %{{.*}}, %{{.*}}83// OGCG:   store i32 %[[AND]], ptr %{{.*}}84// OGCG:   %[[XOR:.*]] = xor i32 %{{.*}}, %{{.*}}85// OGCG:   store i32 %[[XOR]], ptr %{{.*}}86// OGCG:   %[[OR:.*]] = or i32 %{{.*}}, %{{.*}}87// OGCG:   store i32 %[[OR]], ptr %{{.*}}88