brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · e69a69e Raw
69 lines · plain
1// RUN: cir-opt %s -cir-to-llvm -o - | FileCheck %s -check-prefix=MLIR2// RUN: cir-translate %s -cir-to-llvmir --target x86_64-unknown-linux-gnu --disable-cc-lowering  | FileCheck %s -check-prefix=LLVM3 4module {5  cir.func @foo() {6    %0 = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["c"] {alignment = 4 : i64}7    %1 = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["d"] {alignment = 4 : i64}8    %2 = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["y", init] {alignment = 4 : i64}9    %3 = cir.alloca !cir.double, !cir.ptr<!cir.double>, ["e"] {alignment = 8 : i64}10    %4 = cir.alloca !cir.double, !cir.ptr<!cir.double>, ["f"] {alignment = 8 : i64}11    %5 = cir.alloca !cir.double, !cir.ptr<!cir.double>, ["g", init] {alignment = 8 : i64}12    %6 = cir.load %0 : !cir.ptr<!cir.float>, !cir.float13    %7 = cir.load %1 : !cir.ptr<!cir.float>, !cir.float14    %8 = cir.binop(mul, %6, %7) : !cir.float15    cir.store %8, %2 : !cir.float, !cir.ptr<!cir.float>16    %9 = cir.load %2 : !cir.ptr<!cir.float>, !cir.float17    %10 = cir.load %1 : !cir.ptr<!cir.float>, !cir.float18    %11 = cir.binop(div, %9, %10) : !cir.float19    cir.store %11, %2 : !cir.float, !cir.ptr<!cir.float>20    %12 = cir.load %2 : !cir.ptr<!cir.float>, !cir.float21    %13 = cir.load %1 : !cir.ptr<!cir.float>, !cir.float22    %14 = cir.binop(add, %12, %13) : !cir.float23    cir.store %14, %2 : !cir.float, !cir.ptr<!cir.float>24    %15 = cir.load %2 : !cir.ptr<!cir.float>, !cir.float25    %16 = cir.load %1 : !cir.ptr<!cir.float>, !cir.float26    %17 = cir.binop(sub, %15, %16) : !cir.float27    cir.store %17, %2 : !cir.float, !cir.ptr<!cir.float>28    %18 = cir.load %3 : !cir.ptr<!cir.double>, !cir.double29    %19 = cir.load %4 : !cir.ptr<!cir.double>, !cir.double30    %20 = cir.binop(add, %18, %19) : !cir.double31    cir.store %20, %5 : !cir.double, !cir.ptr<!cir.double>32    %21 = cir.load %3 : !cir.ptr<!cir.double>, !cir.double33    %22 = cir.load %4 : !cir.ptr<!cir.double>, !cir.double34    %23 = cir.binop(sub, %21, %22) : !cir.double35    cir.store %23, %5 : !cir.double, !cir.ptr<!cir.double>36    %24 = cir.load %3 : !cir.ptr<!cir.double>, !cir.double37    %25 = cir.load %4 : !cir.ptr<!cir.double>, !cir.double38    %26 = cir.binop(mul, %24, %25) : !cir.double39    cir.store %26, %5 : !cir.double, !cir.ptr<!cir.double>40    %27 = cir.load %3 : !cir.ptr<!cir.double>, !cir.double41    %28 = cir.load %4 : !cir.ptr<!cir.double>, !cir.double42    %29 = cir.binop(div, %27, %28) : !cir.double43    cir.store %29, %5 : !cir.double, !cir.ptr<!cir.double>44    cir.return45  }46}47 48// MLIR: = llvm.alloca {{.*}} f32 {alignment = 4 : i64} : (i64) -> !llvm.ptr49// MLIR: = llvm.alloca {{.*}} f64 {alignment = 8 : i64} : (i64) -> !llvm.ptr50// MLIR: = llvm.fmul {{.*}} : f3251// MLIR: = llvm.fdiv52// MLIR: = llvm.fadd53// MLIR: = llvm.fsub54// MLIR: = llvm.fadd {{.*}} : f6455// MLIR: = llvm.fsub56// MLIR: = llvm.fmul57// MLIR: = llvm.fdiv58 59// LLVM: = alloca float, i6460// LLVM: = alloca double, i6461// LLVM: = fmul float62// LLVM: = fdiv float63// LLVM: = fadd float64// LLVM: = fsub float65// LLVM: = fadd double66// LLVM: = fsub double67// LLVM: = fmul double68// LLVM: = fdiv double69