Index: lib/Target/ARM/ARMISelLowering.cpp =================================================================== --- lib/Target/ARM/ARMISelLowering.cpp +++ lib/Target/ARM/ARMISelLowering.cpp @@ -1617,6 +1617,8 @@ case CallingConv::ARM_AAPCS: return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS); case CallingConv::ARM_AAPCS_VFP: + if (getSubtarget()->isThumb1Only() || !getSubtarget()->hasVFP2()) + report_fatal_error("The aapcs_vfp calling convention is not supported on this target."); return (Return ? RetCC_ARM_AAPCS_VFP : CC_ARM_AAPCS_VFP); case CallingConv::Fast: return (Return ? RetFastCC_ARM_APCS : FastCC_ARM_APCS); Index: test/CodeGen/ARM/aapcs-vfp-call-float-arg.ll =================================================================== --- /dev/null +++ test/CodeGen/ARM/aapcs-vfp-call-float-arg.ll @@ -0,0 +1,26 @@ +; RUN: not llc %s -o - 2>&1 | FileCheck %s + +; ModuleID = 't-call-float-arg.c' +source_filename = "t-call-float-arg.c" +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "thumbv6--linux-gnueabihf" + +; Function Attrs: noinline nounwind optnone +define void @g() #0 { +; CHECK: LLVM ERROR: The aapcs_vfp calling convention is not supported on this target. +entry: + call arm_aapcs_vfpcc void @f(float 1.000000e+00) + ret void +} + +declare arm_aapcs_vfpcc void @f(float) #1 + +attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="arm1136j-s" "target-features"="+dsp,+strict-align,-crypto,-d16,-fp-armv8,-fp-only-sp,-fp16,-neon,-vfp2,-vfp3,-vfp4" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="arm1136j-s" "target-features"="+dsp,+strict-align,-crypto,-d16,-fp-armv8,-fp-only-sp,-fp16,-neon,-vfp2,-vfp3,-vfp4" "unsafe-fp-math"="false" "use-soft-float"="false" } + +!llvm.module.flags = !{!0, !1} +!llvm.ident = !{!2} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{i32 1, !"min_enum_size", i32 4} +!2 = !{!"clang version 5.0.0 "} Index: test/CodeGen/ARM/aapcs-vfp-call-float-result.ll =================================================================== --- /dev/null +++ test/CodeGen/ARM/aapcs-vfp-call-float-result.ll @@ -0,0 +1,26 @@ +; RUN: not llc %s -o - 2>&1 | FileCheck %s + +; ModuleID = 't-call-float-result.c' +source_filename = "t-call-float-result.c" +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "thumbv6--linux-gnueabihf" + +; Function Attrs: noinline nounwind optnone +define float @g() #0 { +; CHECK: LLVM ERROR: The aapcs_vfp calling convention is not supported on this target. +entry: + %call = call arm_aapcs_vfpcc float @f() + ret float %call +} + +declare arm_aapcs_vfpcc float @f() #1 + +attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="arm1136j-s" "target-features"="+dsp,+strict-align,-crypto,-d16,-fp-armv8,-fp-only-sp,-fp16,-neon,-vfp2,-vfp3,-vfp4" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="arm1136j-s" "target-features"="+dsp,+strict-align,-crypto,-d16,-fp-armv8,-fp-only-sp,-fp16,-neon,-vfp2,-vfp3,-vfp4" "unsafe-fp-math"="false" "use-soft-float"="false" } + +!llvm.module.flags = !{!0, !1} +!llvm.ident = !{!2} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{i32 1, !"min_enum_size", i32 4} +!2 = !{!"clang version 5.0.0 "} Index: test/CodeGen/ARM/aapcs-vfp-def-float-arg.ll =================================================================== --- /dev/null +++ test/CodeGen/ARM/aapcs-vfp-def-float-arg.ll @@ -0,0 +1,24 @@ +; RUN: not llc %s -o - 2>&1 | FileCheck %s + +; ModuleID = 't-def-float-arg.c' +source_filename = "t-def-float-arg.c" +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "thumbv6--linux-gnueabihf" + +; Function Attrs: noinline nounwind optnone +define arm_aapcs_vfpcc void @f(float %x) #0 { +; CHECK: LLVM ERROR: The aapcs_vfp calling convention is not supported on this target. +entry: + %x.addr = alloca float, align 4 + store float %x, float* %x.addr, align 4 + ret void +} + +attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="arm1136j-s" "target-features"="+dsp,+strict-align,-crypto,-d16,-fp-armv8,-fp-only-sp,-fp16,-neon,-vfp2,-vfp3,-vfp4" "unsafe-fp-math"="false" "use-soft-float"="false" } + +!llvm.module.flags = !{!0, !1} +!llvm.ident = !{!2} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{i32 1, !"min_enum_size", i32 4} +!2 = !{!"clang version 5.0.0 "} Index: test/CodeGen/ARM/aapcs-vfp-def-float-result.ll =================================================================== --- /dev/null +++ test/CodeGen/ARM/aapcs-vfp-def-float-result.ll @@ -0,0 +1,22 @@ +; RUN: not llc %s -o - 2>&1 | FileCheck %s + +; ModuleID = 't-def-float-result.c' +source_filename = "t-def-float-result.c" +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "thumbv6--linux-gnueabihf" + +; Function Attrs: noinline nounwind optnone +define arm_aapcs_vfpcc float @f() #0 { +; CHECK: LLVM ERROR: The aapcs_vfp calling convention is not supported on this target. +entry: + ret float 1.000000e+00 +} + +attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="arm1136j-s" "target-features"="+dsp,+strict-align,-crypto,-d16,-fp-armv8,-fp-only-sp,-fp16,-neon,-vfp2,-vfp3,-vfp4" "unsafe-fp-math"="false" "use-soft-float"="false" } + +!llvm.module.flags = !{!0, !1} +!llvm.ident = !{!2} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{i32 1, !"min_enum_size", i32 4} +!2 = !{!"clang version 5.0.0 "}