From 24ec87debb76a59016e854a7b28bd8e99fa74dc5 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Tue, 2 Dec 2014 17:15:22 +0000 Subject: [PATCH] AArch64: make register block rules apply to vector types too. The blocking code originated in ARM, which is more aggressive about casting types to a canonical representative before doing anything else, so I missed out most vector HFAs and broke the ABI. This should fix it. llvm-svn: 223126 --- llvm/lib/Target/AArch64/AArch64CallingConvention.h | 6 +- llvm/test/CodeGen/AArch64/argument-blocks.ll | 98 ++++++++++++++++++++++ 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64CallingConvention.h b/llvm/lib/Target/AArch64/AArch64CallingConvention.h index 6355164..8c798b7 100644 --- a/llvm/lib/Target/AArch64/AArch64CallingConvention.h +++ b/llvm/lib/Target/AArch64/AArch64CallingConvention.h @@ -88,11 +88,11 @@ static bool CC_AArch64_Custom_Block(unsigned &ValNo, MVT &ValVT, MVT &LocVT, ArrayRef RegList; if (LocVT.SimpleTy == MVT::i64) RegList = XRegList; - else if (LocVT.SimpleTy == MVT::f32) + else if (LocVT.SimpleTy == MVT::f32 || LocVT.is32BitVector()) RegList = SRegList; - else if (LocVT.SimpleTy == MVT::f64) + else if (LocVT.SimpleTy == MVT::f64 || LocVT.is64BitVector()) RegList = DRegList; - else if (LocVT.SimpleTy == MVT::v2f64) + else if (LocVT.SimpleTy == MVT::f128 || LocVT.is128BitVector()) RegList = QRegList; else { // Not an array we want to split up after all. diff --git a/llvm/test/CodeGen/AArch64/argument-blocks.ll b/llvm/test/CodeGen/AArch64/argument-blocks.ll index cc65541..9204da8 100644 --- a/llvm/test/CodeGen/AArch64/argument-blocks.ll +++ b/llvm/test/CodeGen/AArch64/argument-blocks.ll @@ -90,3 +90,101 @@ define i64 @test_smallstruct_block_consume([7 x i64], [2 x i64] %in, i64 %rhs) { %sum = add i64 %lhs, %rhs ret i64 %sum } + +define <1 x i64> @test_v1i64_blocked([7 x double], [2 x <1 x i64>] %in) { +; CHECK-LABEL: test_v1i64_blocked: +; CHECK: ldr d0, [sp] + %val = extractvalue [2 x <1 x i64>] %in, 0 + ret <1 x i64> %val +} + +define <1 x double> @test_v1f64_blocked([7 x double], [2 x <1 x double>] %in) { +; CHECK-LABEL: test_v1f64_blocked: +; CHECK: ldr d0, [sp] + %val = extractvalue [2 x <1 x double>] %in, 0 + ret <1 x double> %val +} + +define <2 x i32> @test_v2i32_blocked([7 x double], [2 x <2 x i32>] %in) { +; CHECK-LABEL: test_v2i32_blocked: +; CHECK: ldr d0, [sp] + %val = extractvalue [2 x <2 x i32>] %in, 0 + ret <2 x i32> %val +} + +define <2 x float> @test_v2f32_blocked([7 x double], [2 x <2 x float>] %in) { +; CHECK-LABEL: test_v2f32_blocked: +; CHECK: ldr d0, [sp] + %val = extractvalue [2 x <2 x float>] %in, 0 + ret <2 x float> %val +} + +define <4 x i16> @test_v4i16_blocked([7 x double], [2 x <4 x i16>] %in) { +; CHECK-LABEL: test_v4i16_blocked: +; CHECK: ldr d0, [sp] + %val = extractvalue [2 x <4 x i16>] %in, 0 + ret <4 x i16> %val +} + +define <4 x half> @test_v4f16_blocked([7 x double], [2 x <4 x half>] %in) { +; CHECK-LABEL: test_v4f16_blocked: +; CHECK: ldr d0, [sp] + %val = extractvalue [2 x <4 x half>] %in, 0 + ret <4 x half> %val +} + +define <8 x i8> @test_v8i8_blocked([7 x double], [2 x <8 x i8>] %in) { +; CHECK-LABEL: test_v8i8_blocked: +; CHECK: ldr d0, [sp] + %val = extractvalue [2 x <8 x i8>] %in, 0 + ret <8 x i8> %val +} + +define <2 x i64> @test_v2i64_blocked([7 x double], [2 x <2 x i64>] %in) { +; CHECK-LABEL: test_v2i64_blocked: +; CHECK: ldr q0, [sp] + %val = extractvalue [2 x <2 x i64>] %in, 0 + ret <2 x i64> %val +} + +define <2 x double> @test_v2f64_blocked([7 x double], [2 x <2 x double>] %in) { +; CHECK-LABEL: test_v2f64_blocked: +; CHECK: ldr q0, [sp] + %val = extractvalue [2 x <2 x double>] %in, 0 + ret <2 x double> %val +} + +define <4 x i32> @test_v4i32_blocked([7 x double], [2 x <4 x i32>] %in) { +; CHECK-LABEL: test_v4i32_blocked: +; CHECK: ldr q0, [sp] + %val = extractvalue [2 x <4 x i32>] %in, 0 + ret <4 x i32> %val +} + +define <4 x float> @test_v4f32_blocked([7 x double], [2 x <4 x float>] %in) { +; CHECK-LABEL: test_v4f32_blocked: +; CHECK: ldr q0, [sp] + %val = extractvalue [2 x <4 x float>] %in, 0 + ret <4 x float> %val +} + +define <8 x i16> @test_v8i16_blocked([7 x double], [2 x <8 x i16>] %in) { +; CHECK-LABEL: test_v8i16_blocked: +; CHECK: ldr q0, [sp] + %val = extractvalue [2 x <8 x i16>] %in, 0 + ret <8 x i16> %val +} + +define <8 x half> @test_v8f16_blocked([7 x double], [2 x <8 x half>] %in) { +; CHECK-LABEL: test_v8f16_blocked: +; CHECK: ldr q0, [sp] + %val = extractvalue [2 x <8 x half>] %in, 0 + ret <8 x half> %val +} + +define <16 x i8> @test_v16i8_blocked([7 x double], [2 x <16 x i8>] %in) { +; CHECK-LABEL: test_v16i8_blocked: +; CHECK: ldr q0, [sp] + %val = extractvalue [2 x <16 x i8>] %in, 0 + ret <16 x i8> %val +} -- 2.7.4