brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · a3cbf20 Raw
33 lines · plain
1// RUN: %flang_fc1 -triple i686 -emit-llvm  %s -o - | FileCheck %s2// REQUIRES: x86-registered-target3 4// This is a check for calling malloc using i32 when on a 32-bit target (only).5// It doesn't contain the comprehensive tests that alloc.fir has, and6// that file should be used to exercise most code paths.7 8module attributes {9    fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.target_triple = "i686"10} {11 12// CHECK-LABEL: define ptr @allocmem_scalar_nonchar(13// CHECK: call ptr @malloc(i32 4)14func.func @allocmem_scalar_nonchar() -> !fir.heap<i32> {15  %1 = fir.allocmem i3216  return %1 : !fir.heap<i32>17}18 19// CHECK-LABEL: define ptr @allocmem_scalar_dynchar(20// CHECK-SAME: i32 %[[len:.*]])21// CHECK: %[[mul1:.*]] = sext i32 %[[len]] to i6422// CHECK: %[[mul2:.*]] = mul i64 1, %[[mul1]]23// CHECK: %[[cmp:.*]] = icmp sgt i64 %[[mul2]], 024// CHECK: %[[sz:.*]] = select i1 %[[cmp]], i64 %[[mul2]], i64 125// CHECK: %[[trunc:.*]] = trunc i64 %[[sz]] to i3226// CHECK: call ptr @malloc(i32 %[[trunc]])27func.func @allocmem_scalar_dynchar(%l : i32) -> !fir.heap<!fir.char<1,?>> {28  %1 = fir.allocmem !fir.char<1,?>(%l : i32)29  return %1 : !fir.heap<!fir.char<1,?>>30}31 32}33