brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 5d3de8c Raw
65 lines · plain
1// Check that the wide integer `arith.fptoui` emulation produces the same result as wide2// `arith.fptoui`. Emulate i64 ops with i32 ops.3 4// RUN: mlir-opt %s --convert-scf-to-cf --convert-cf-to-llvm --convert-vector-to-llvm \5// RUN:             --convert-func-to-llvm --convert-arith-to-llvm | \6// RUN:   mlir-runner -e entry -entry-point-result=void \7// RUN:                   --shared-libs=%mlir_c_runner_utils | \8// RUN:   FileCheck %s --match-full-lines9 10// RUN: mlir-opt %s --test-arith-emulate-wide-int="widest-int-supported=32" \11// RUN:             --convert-scf-to-cf --convert-cf-to-llvm --convert-vector-to-llvm \12// RUN:             --convert-func-to-llvm --convert-arith-to-llvm | \13// RUN:   mlir-runner -e entry -entry-point-result=void \14// RUN:                   --shared-libs=%mlir_c_runner_utils | \15// RUN:   FileCheck %s --match-full-lines16 17// Ops in this function *only* will be emulated using i32 types.18func.func @emulate_fptoui(%arg: f64) -> i64 {19  %res = arith.fptoui %arg : f64 to i6420  return %res : i6421}22 23func.func @check_fptoui(%arg : f64) -> () {24  %res = func.call @emulate_fptoui(%arg) : (f64) -> (i64)25  vector.print %res : i6426  return27}28 29func.func @entry() {30  %cst0 = arith.constant 0.0 : f6431  %cst1 = arith.constant 1.0 : f6432  %cst1_5 = arith.constant 1.5 : f6433 34  %cstpow20 = arith.constant 1048576.0 : f6435  %cst_i32_max = arith.constant 4294967295.0 : f6436  %cst_i32_overflow = arith.constant 4294967296.0 : f6437 38 39  %cstpow40 = arith.constant 1099511627776.0 : f6440  %cst_pow40ppow20 = arith.constant 1099512676352.0 : f6441 42  %cst_nzero = arith.constant 0x8000000000000000 : f6443 44  // CHECK:         045  func.call @check_fptoui(%cst0) : (f64) -> ()46  // CHECK-NEXT:    147  func.call @check_fptoui(%cst1) : (f64) -> ()48  // CHECK-NEXT:    149  func.call @check_fptoui(%cst1_5) : (f64) -> ()50  // CHECK-NEXT:    104857651  func.call @check_fptoui(%cstpow20) : (f64) -> ()52  // CHECK-NEXT:    429496729553  func.call @check_fptoui(%cst_i32_max) : (f64) -> ()54  // CHECK-NEXT:    429496729655  func.call @check_fptoui(%cst_i32_overflow) : (f64) -> ()56  // CHECK-NEXT:    109951162777657  func.call @check_fptoui(%cstpow40) : (f64) -> ()58  // CHECK-NEXT:    109951267635259  func.call @check_fptoui(%cst_pow40ppow20) : (f64) -> ()60  // CHECK-NEXT:    061  func.call @check_fptoui(%cst_nzero) : (f64) -> ()62 63  return64}65