brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · c0ca3da Raw
85 lines · c
1// RUN: %clang_cc1 -triple s390x-ibm-zos -O2 -emit-llvm %s -o - | FileCheck %s --check-prefix=X642#include <stddef.h>3void *__malloc31(size_t);4 5int test_1() {6  // X64-LABEL: define {{.*}} i32 @test_1()7  // X64: ret i32 %add208  int *__ptr32 a;9  int *b;10  int i;11  int sum1, sum2, sum3;12 13  a = (int *__ptr32)__malloc31(sizeof(int) * 10);14 15  b = a;16  sum1 = 0;17  for (i = 0; i < 10; ++i) {18    a[i] = i;19    sum1 += i;20  }21 22  sum2 = 0;23  for (i = 0; i < 10; ++i) {24    sum2 += a[i];25  }26  sum3 = 0;27  for (i = 0; i < 10; ++i) {28    sum3 += b[i];29  }30 31  return (sum1 + sum2 + sum3);32}33 34int test_2() {35  // X64-LABEL: define {{.*}} i32 @test_2()36  // X64: ret i32 437  int *a = (int *)__malloc31(sizeof(int));38  int *__ptr32 b;39 40  *a = 99;41  b = a;42  *b = 44;43 44  // Test should return 445  return (*b - 40);46}47 48int test_3() {49  // X64-LABEL: define {{.*}} i32 @test_3()50  // X64: ret i32 451  int *a = (int *)__malloc31(sizeof(int));52  int *__ptr32 b;53 54  *a = 99;55  b = a;56 57  // Test should return 458  return (*b - 95);59}60 61int test_4() {62  // X64-LABEL: define {{.*}} i32 @test_4()63  // X64: ret i32 164  int *a = (int *)__malloc31(sizeof(int));65  float *d = (float *)__malloc31(sizeof(float));66 67  int *__ptr32 b;68  int *c;69 70  float *__ptr32 e;71  float *f;72 73  *a = 0;74  *d = 0.0;75 76  b = a;77  c = a;78  e = d;79  f = d;80 81  // Test should return 182  return (b == c && e == f);83}84 85