Skip to contentSkip to conversation

target/arm: report ARMv8.2 FP16 for ARM -cpu max

PATCH In review Alex Bennée 2 participants 3 messages Jul 10, 2019 – Jul 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/arm: report ARMv8.2 FP16 for ARM -cpu max

When we converted to using feature bits in 602f6e42cfbf we missed out the fact (dp && arm_dc_feature(s, ARM_FEATURE_V8)) was supported for -cpu max configurations. This caused a regression in the GCC test suite. Fix this by setting the appropriate FP16 bits in mvfr1.FPHP.

---
 target/arm/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)
target/arm/cpu.c +4 -0
index e75a64a25a..0a0a202fe3 100644
@@ -2452,6 +2452,10 @@ static void arm_max_initfn(Object *obj)
             t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1);
             cpu->isar.id_isar6 = t;
 
+            t = cpu->isar.mvfr1;
+            t = FIELD_DP32(t, MVFR1, FPHP, 2);     /* v8.2 FP16 */
+            cpu->isar.mvfr1 = t;
+
             t = cpu->isar.mvfr2;
             t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */
             t = FIELD_DP32(t, MVFR2, FPMISC, 4);   /* FP MaxNum */
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Alex Bennée

When we converted to using feature bits in 602f6e42cfbf we missed out the fact (dp && arm_dc_feature(s, ARM_FEATURE_V8)) was supported for -cpu max configurations. This caused a regression in the GCC test suite. Fix this by setting the appropriate FP16 bits in mvfr1.FPHP.

---
 target/arm/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)
target/arm/cpu.c +0 -0
index e75a64a25a..0a0a202fe3 100644

target/arm/cpu.c static void arm_max_initfn(Object *obj) · line 2456

Quoted 5 lines
target/arm/cpu.c +2 -0
@@ -2452,6 +2452,10 @@ static void arm_max_initfn(Object *obj)
             t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1);
             cpu->isar.id_isar6 = t;
 
+            t = cpu->isar.mvfr1;
+            t = FIELD_DP32(t, MVFR1, FPHP, 2);     /* v8.2 FP16 */

The comment is wrong. This is not full v8.2 FP16 support (which would be value 3, plus a change to SIMDHP), but v8.0 support for double<->half conversions.

Otherwise,

r~

#2 lore raw
Quoted 20 lines · Richard Henderson
Quoted 19 lines · Alex Bennée

When we converted to using feature bits in 602f6e42cfbf we missed out the fact (dp && arm_dc_feature(s, ARM_FEATURE_V8)) was supported for -cpu max configurations. This caused a regression in the GCC test suite. Fix this by setting the appropriate FP16 bits in mvfr1.FPHP.

---
 target/arm/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)
target/arm/cpu.c +0 -0
index e75a64a25a..0a0a202fe3 100644
@@ -2452,6 +2452,10 @@ static void arm_max_initfn(Object *obj)
             t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1);
             cpu->isar.id_isar6 = t;
 
Quoted 6 lines

target/arm/cpu.c static void arm_max_initfn(Object *obj) · line 2456

Quoted 2 lines
target/arm/cpu.c +2 -0
+            t = cpu->isar.mvfr1;
+            t = FIELD_DP32(t, MVFR1, FPHP, 2);     /* v8.2 FP16 */

The comment is wrong. This is not full v8.2 FP16 support (which would be value 3, plus a change to SIMDHP), but v8.0 support for double<->half conversions.

Good catch - will fix in v2.

Quoted 6 lines

Otherwise,

r~

--
Alex Bennée