From 1a53996c316761894fbc0e542fab178a14f7064c Mon Sep 17 00:00:00 2001 From: Charlie Turner Date: Fri, 12 Dec 2014 11:59:18 +0000 Subject: [PATCH] Emit Tag_ABI_FP_16bit_format build attribute. The __fp16 type is unconditionally exposed. Since -mfp16-format is not yet supported, there is not a user switch to change this behaviour. This build attribute should capture the default behaviour of the compiler, which is to expose the IEEE 754 version of __fp16. When -mfp16-format is emitted, that will be the way to control the value of this build attribute. Change-Id: I8a46641ff0fd2ef8ad0af5f482a6d1af2ac3f6b0 llvm-svn: 224115 --- llvm/include/llvm/Support/ARMBuildAttributes.h | 3 +++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp | 7 +++++++ llvm/test/CodeGen/ARM/build-attributes.ll | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/llvm/include/llvm/Support/ARMBuildAttributes.h b/llvm/include/llvm/Support/ARMBuildAttributes.h index b56fd49..96a8219 100644 --- a/llvm/include/llvm/Support/ARMBuildAttributes.h +++ b/llvm/include/llvm/Support/ARMBuildAttributes.h @@ -200,6 +200,9 @@ enum { // Tag_FP_HP_extension, (=36), uleb128 AllowHPFP = 1, // Allow use of Half Precision FP + // Tag_FP_16bit_format, (=38), uleb128 + FP16FormatIEEE = 1, + // Tag_MPextension_use, (=42), uleb128 AllowMP = 1, // Allow use of MP extensions diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp index d3fdbcc..0300f58 100644 --- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp @@ -782,6 +782,13 @@ void ARMAsmPrinter::emitAttributes() { if (Subtarget->hasFP16()) ATS.emitAttribute(ARMBuildAttrs::FP_HP_extension, ARMBuildAttrs::AllowHPFP); + // FIXME: To support emitting this build attribute as GCC does, the + // -mfp16-format option and associated plumbing must be + // supported. For now the __fp16 type is exposed by default, so this + // attribute should be emitted with value 1. + ATS.emitAttribute(ARMBuildAttrs::ABI_FP_16bit_format, + ARMBuildAttrs::FP16FormatIEEE); + if (Subtarget->hasMPExtension()) ATS.emitAttribute(ARMBuildAttrs::MPextension_use, ARMBuildAttrs::AllowMP); diff --git a/llvm/test/CodeGen/ARM/build-attributes.ll b/llvm/test/CodeGen/ARM/build-attributes.ll index 738fe66..d017e06 100644 --- a/llvm/test/CodeGen/ARM/build-attributes.ll +++ b/llvm/test/CodeGen/ARM/build-attributes.ll @@ -148,6 +148,7 @@ ; V6-NOT: .eabi_attribute 27 ; V6-NOT: .eabi_attribute 28 ; V6-NOT: .eabi_attribute 36 +; V6: .eabi_attribute 38, 1 ; V6-NOT: .eabi_attribute 42 ; V6-NOT: .eabi_attribute 68 @@ -178,6 +179,7 @@ ; V6M-NOT: .eabi_attribute 27 ; V6M-NOT: .eabi_attribute 28 ; V6M-NOT: .eabi_attribute 36 +; V6M: .eabi_attribute 38, 1 ; V6M-NOT: .eabi_attribute 42 ; V6M-NOT: .eabi_attribute 68 @@ -206,6 +208,7 @@ ; ARM1156T2F-S-NOT: .eabi_attribute 27 ; ARM1156T2F-S-NOT: .eabi_attribute 28 ; ARM1156T2F-S-NOT: .eabi_attribute 36 +; ARM1156T2F-S: .eabi_attribute 38, 1 ; ARM1156T2F-S-NOT: .eabi_attribute 42 ; ARM1156T2F-S-NOT: .eabi_attribute 68 @@ -236,6 +239,7 @@ ; V7M-NOT: .eabi_attribute 27 ; V7M-NOT: .eabi_attribute 28 ; V7M-NOT: .eabi_attribute 36 +; V7M: .eabi_attribute 38, 1 ; V7M-NOT: .eabi_attribute 42 ; V7M-NOT: .eabi_attribute 44 ; V7M-NOT: .eabi_attribute 68 @@ -262,6 +266,7 @@ ; V7-NOT: .eabi_attribute 27 ; V7-NOT: .eabi_attribute 28 ; V7-NOT: .eabi_attribute 36 +; V7: .eabi_attribute 38, 1 ; V7-NOT: .eabi_attribute 42 ; V7-NOT: .eabi_attribute 68 @@ -389,6 +394,11 @@ ; CORTEX-A7-NOFPU: .eabi_attribute 36, 1 ; CORTEX-A7-FPUV4: .eabi_attribute 36, 1 +; Tag_FP_16bit_format +; CORTEX-A7-CHECK: .eabi_attribute 38, 1 +; CORTEX-A7-NOFPU: .eabi_attribute 38, 1 +; CORTEX-A7-FPUV4: .eabi_attribute 38, 1 + ; Tag_MPextension_use ; CORTEX-A7-CHECK: .eabi_attribute 42, 1 ; CORTEX-A7-NOFPU: .eabi_attribute 42, 1 @@ -496,6 +506,7 @@ ; CORTEX-A9-SOFT-NOT: .eabi_attribute 27 ; CORTEX-A9-SOFT-NOT: .eabi_attribute 28 ; CORTEX-A9-SOFT: .eabi_attribute 36, 1 +; CORTEX-A9-SOFT: .eabi_attribute 38, 1 ; CORTEX-A9-SOFT: .eabi_attribute 42, 1 ; CORTEX-A9-SOFT: .eabi_attribute 68, 1 @@ -524,6 +535,7 @@ ; CORTEX-A9-HARD-NOT: .eabi_attribute 27 ; CORTEX-A9-HARD: .eabi_attribute 28, 1 ; CORTEX-A9-HARD: .eabi_attribute 36, 1 +; CORTEX-A9-HARD: .eabi_attribute 38, 1 ; CORTEX-A9-HARD: .eabi_attribute 42, 1 ; CORTEX-A9-HARD: .eabi_attribute 68, 1 @@ -605,6 +617,7 @@ ; CORTEX-A15-NOT: .eabi_attribute 27 ; CORTEX-A15-NOT: .eabi_attribute 28 ; CORTEX-A15: .eabi_attribute 36, 1 +; CORTEX-A15: .eabi_attribute 38, 1 ; CORTEX-A15: .eabi_attribute 42, 1 ; CORTEX-A15: .eabi_attribute 44, 2 ; CORTEX-A15: .eabi_attribute 68, 3 @@ -686,6 +699,7 @@ ; CORTEX-M0-NOT: .eabi_attribute 27 ; CORTEX-M0-NOT: .eabi_attribute 28 ; CORTEX-M0-NOT: .eabi_attribute 36 +; CORTEX-M0: .eabi_attribute 38, 1 ; CORTEX-M0-NOT: .eabi_attribute 42 ; CORTEX-M0-NOT: .eabi_attribute 68 @@ -716,6 +730,7 @@ ; CORTEX-M3-NOT: .eabi_attribute 27 ; CORTEX-M3-NOT: .eabi_attribute 28 ; CORTEX-M3-NOT: .eabi_attribute 36 +; CORTEX-M3: .eabi_attribute 38, 1 ; CORTEX-M3-NOT: .eabi_attribute 42 ; CORTEX-M3-NOT: .eabi_attribute 44 ; CORTEX-M3-NOT: .eabi_attribute 68 @@ -746,6 +761,7 @@ ; CORTEX-M4-SOFT: .eabi_attribute 27, 1 ; CORTEX-M4-SOFT-NOT: .eabi_attribute 28 ; CORTEX-M4-SOFT: .eabi_attribute 36, 1 +; CORTEX-M4-SOFT: .eabi_attribute 38, 1 ; CORTEX-M4-SOFT-NOT: .eabi_attribute 42 ; CORTEX-M4-SOFT-NOT: .eabi_attribute 44 ; CORTEX-M4-SOFT-NOT: .eabi_attribute 68 @@ -775,6 +791,7 @@ ; CORTEX-M4-HARD: .eabi_attribute 27, 1 ; CORTEX-M4-HARD: .eabi_attribute 28, 1 ; CORTEX-M4-HARD: .eabi_attribute 36, 1 +; CORTEX-M4-HARD: .eabi_attribute 38, 1 ; CORTEX-M4-HARD-NOT: .eabi_attribute 42 ; CORTEX-M4-HARD-NOT: .eabi_attribute 44 ; CORTEX-M4-HARD-NOT: .eabi_attribute 68 @@ -808,6 +825,7 @@ ; CORTEX-M7-SINGLE: .eabi_attribute 27, 1 ; CORTEX-M7-DOUBLE-NOT: .eabi_attribute 27 ; CORTEX-M7: .eabi_attribute 36, 1 +; CORTEX-M7: .eabi_attribute 38, 1 ; CORTEX-M7: .eabi_attribute 14, 0 ; CORTEX-M7-NOFPU-FAST-NOT: .eabi_attribute 19 @@ -838,6 +856,7 @@ ; CORTEX-R5: .eabi_attribute 27, 1 ; CORTEX-R5-NOT: .eabi_attribute 28 ; CORTEX-R5-NOT: .eabi_attribute 36 +; CORTEX-R5: .eabi_attribute 38, 1 ; CORTEX-R5-NOT: .eabi_attribute 42 ; CORTEX-R5: .eabi_attribute 44, 2 ; CORTEX-R5-NOT: .eabi_attribute 68 @@ -867,6 +886,7 @@ ; CORTEX-A53-NOT: .eabi_attribute 27 ; CORTEX-A53-NOT: .eabi_attribute 28 ; CORTEX-A53: .eabi_attribute 36, 1 +; CORTEX-A53: .eabi_attribute 38, 1 ; CORTEX-A53: .eabi_attribute 42, 1 ; CORTEX-A53-NOT: .eabi_attribute 44 ; CORTEX-A53: .eabi_attribute 68, 3 @@ -896,6 +916,7 @@ ; CORTEX-A57-NOT: .eabi_attribute 27 ; CORTEX-A57-NOT: .eabi_attribute 28 ; CORTEX-A57: .eabi_attribute 36, 1 +; CORTEX-A57: .eabi_attribute 38, 1 ; CORTEX-A57: .eabi_attribute 42, 1 ; CORTEX-A57-NOT: .eabi_attribute 44 ; CORTEX-A57: .eabi_attribute 68, 3 -- 2.7.4