brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · e119064 Raw
113 lines · plain
1// RUN: tco --target=i386-unknown-linux-gnu %s | FileCheck %s --check-prefix=I322// RUN: tco --target=x86_64-unknown-linux-gnu %s | FileCheck %s --check-prefix=X643// RUN: tco --target=aarch64-unknown-linux-gnu %s | FileCheck %s --check-prefix=AARCH644// RUN: tco --target=powerpc64le-unknown-linux-gnu %s | FileCheck %s --check-prefix=PPC5 6// I32-LABEL: define i64 @gen4()7// X64-LABEL: define <2 x float> @gen4()8// AARCH64-LABEL: define { float, float } @gen4()9// PPC-LABEL: define { float, float } @gen4()10func.func @gen4() -> complex<f32> {11  %1 = fir.undefined complex<f32>12  %2 = arith.constant 2.0 : f3213  %c0 = arith.constant 0 : i3214  %4 = fir.insert_value %1, %2, [0 : index] : (complex<f32>, f32) -> complex<f32>15  %c1 = arith.constant 1 : i3216  %5 = arith.constant -42.0 : f3217  %6 = fir.insert_value %4, %5, [1 : index] : (complex<f32>, f32) -> complex<f32>18  // I32: store { float, float } { float 2.000000e+00, float -4.200000e+01 }19  // I32: %[[load:.*]] = load i64, ptr20  // I32: ret i64 %[[load]]21  // X64: store { float, float } { float 2.000000e+00, float -4.200000e+01 }22  // X64: %[[load:.*]] = load <2 x float>, ptr23  // X64: ret <2 x float> %[[load]]24  // AARCH64: ret { float, float }25  // PPC: ret { float, float }26  return %6 : complex<f32>27}28 29// I32-LABEL: define void @gen8(ptr noalias sret({ double, double }) align 4 captures(none) %30// X64-LABEL: define { double, double } @gen8()31// AARCH64-LABEL: define { double, double } @gen8()32// PPC-LABEL: define { double, double } @gen8()33func.func @gen8() -> complex<f64> {34  %1 = fir.undefined complex<f64>35  %2 = arith.constant 1.0 : f6436  %3 = arith.constant -4.0 : f6437  %c0 = arith.constant 0 : i3238  %4 = fir.insert_value %1, %3, [0 : index] : (complex<f64>, f64) -> complex<f64>39  %c1 = arith.constant 1 : i3240  %5 = fir.insert_value %4, %2, [1 : index] : (complex<f64>, f64) -> complex<f64>41  // I32: store { double, double } { double -4.000000e+00, double 1.000000e+00 }42  // X64: store { double, double } { double -4.000000e+00, double 1.000000e+00 }43  // X64: %[[load:.*]] = load { double, double }44  // X64: ret { double, double } %[[load]]45  // AARCH64: ret { double, double }46  // PPC: ret { double, double }47  return %5 : complex<f64>48}49 50// I32: declare void @sink4(ptr byval({ float, float }) align 4)51// X64: declare void @sink4(<2 x float>)52// AARCH64: declare void @sink4([2 x float])53// PPC: declare void @sink4(float, float)54func.func private @sink4(complex<f32>) -> ()55 56// I32: declare void @sink8(ptr byval({ double, double }) align 4)57// X64: declare void @sink8(double, double)58// AARCH64: declare void @sink8([2 x double])59// PPC: declare void @sink8(double, double)60func.func private @sink8(complex<f64>) -> ()61 62// I32-LABEL: define void @call4()63// X64-LABEL: define void @call4()64// AARCH64-LABEL: define void @call4()65func.func @call4() {66  // I32: = call i64 @gen4()67  // X64: = call <2 x float> @gen4()68  // AARCH64: = call { float, float } @gen4()69  // PPC: = call { float, float } @gen4()70  %1 = fir.call @gen4() : () -> complex<f32>71  // I32: call void @sink4(ptr byval({ float, float }) align 4 %72  // X64: call void @sink4(<2 x float> %73  // AARCH64: call void @sink4([2 x float] %74  // PPC: call void @sink4(float %{{.*}}, float %{{.*}})75  fir.call @sink4(%1) : (complex<f32>) -> ()76  return77}78 79// I32-LABEL: define void @call8()80// X64-LABEL: define void @call8()81// AARCH64-LABEL: define void @call8()82func.func @call8() {83  // I32: call void @gen8(ptr sret({ double, double }) align 4 %84  // X64: = call { double, double } @gen8()85  // AARCH64: = call { double, double } @gen8()86  // PPC: = call { double, double } @gen8()87  %1 = fir.call @gen8() : () -> complex<f64>88  // I32: call void @sink8(ptr byval({ double, double }) align 4 %89  // X64: call void @sink8(double %{{[0-9]*}}, double %{{[0-9]*}})90  // AARCH64: call void @sink8([2 x double] %91  // PPC: call void @sink8(double %{{.*}}, double %{{.*}})92  fir.call @sink8(%1) : (complex<f64>) -> ()93  return94}95 96// I32-LABEL: define i64 @char1lensum(ptr {{[^%]*}}%0, ptr {{[^%]*}}%1, i32 %2, i32 %3)97// X64-LABEL: define i64 @char1lensum(ptr {{[^%]*}}%0, ptr {{[^%]*}}%1, i64 %2, i64 %3)98// PPC-LABEL: define i64 @char1lensum(ptr {{[^%]*}}%0, ptr {{[^%]*}}%1, i64 %2, i64 %3)99func.func @char1lensum(%arg0 : !fir.boxchar<1>, %arg1 : !fir.boxchar<1>) -> i64 {100  // X64-DAG: %[[p0:.*]] = insertvalue { ptr, i64 } undef, ptr %1, 0101  // X64-DAG: = insertvalue { ptr, i64 } %[[p0]], i64 %3, 1102  // X64-DAG: %[[p1:.*]] = insertvalue { ptr, i64 } undef, ptr %0, 0103  // X64-DAG: = insertvalue { ptr, i64 } %[[p1]], i64 %2, 1104  %1:2 = fir.unboxchar %arg0 : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1>>, i64)105  %2:2 = fir.unboxchar %arg1 : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1>>, i64)106  // I32: %[[add:.*]] = add i64 %107  // X64: %[[add:.*]] = add i64 %108  %3 = arith.addi %1#1, %2#1 : i64109  // I32: ret i64 %[[add]]110  // X64: ret i64 %[[add]]111  return %3 : i64112}113