brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 5fb3059 Raw
52 lines · plain
1// RUN: mlir-opt -finalize-memref-to-llvm  %s | FileCheck %s2 3// CHECK-LABEL: @empty4func.func @empty() {5  // CHECK: llvm.intr.stacksave6  // CHECK: llvm.br7  memref.alloca_scope {8    memref.alloca_scope.return9  }10  // CHECK: llvm.intr.stackrestore11  // CHECK: llvm.br12  return13}14 15// CHECK-LABEL: @returns_nothing16func.func @returns_nothing(%b: f32) {17  %a = arith.constant 10.0 : f3218  // CHECK: llvm.intr.stacksave19  memref.alloca_scope {20    %c = arith.addf %a, %b : f3221    memref.alloca_scope.return22  }23  // CHECK: llvm.intr.stackrestore24  return25}26 27// CHECK-LABEL: @returns_one_value28func.func @returns_one_value(%b: f32) -> f32 {29  %a = arith.constant 10.0 : f3230  // CHECK: llvm.intr.stacksave31  %result = memref.alloca_scope -> f32 {32    %c = arith.addf %a, %b : f3233    memref.alloca_scope.return %c: f3234  }35  // CHECK: llvm.intr.stackrestore36  return %result : f3237}38 39// CHECK-LABEL: @returns_multiple_values40func.func @returns_multiple_values(%b: f32) -> f32 {41  %a = arith.constant 10.0 : f3242  // CHECK: llvm.intr.stacksave43  %result1, %result2 = memref.alloca_scope -> (f32, f32) {44    %c = arith.addf %a, %b : f3245    %d = arith.subf %a, %b : f3246    memref.alloca_scope.return %c, %d: f32, f3247  }48  // CHECK: llvm.intr.stackrestore49  %result = arith.addf %result1, %result2 : f3250  return %result : f3251}52