Skip to contentSkip to conversation

target-alpha fpu improvements

GIT PULL Applied Richard Henderson 2 participants 8 messages May 21, 2015 – May 22, 2015

lore
Share & tools
lore
#1 lore raw

[Qemu-devel] [PULL v2 17/18] target-alpha: Rewrite helper_zapnot

In reply to Richard Henderson

This form produces significantly smaller code on x86_64.

---
 target-alpha/int_helper.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)
target-alpha/int_helper.c +12 -18
index 8e4537f..74f38cb 100644
@@ -37,31 +37,25 @@ uint64_t helper_cttz(uint64_t arg)
     return ctz64(arg);
 }
 
-static inline uint64_t byte_zap(uint64_t op, uint8_t mskb)
+uint64_t helper_zapnot(uint64_t val, uint64_t mskb)
 {
     uint64_t mask;
 
-    mask = 0;
-    mask |= ((mskb >> 0) & 1) * 0x00000000000000FFULL;
-    mask |= ((mskb >> 1) & 1) * 0x000000000000FF00ULL;
-    mask |= ((mskb >> 2) & 1) * 0x0000000000FF0000ULL;
-    mask |= ((mskb >> 3) & 1) * 0x00000000FF000000ULL;
-    mask |= ((mskb >> 4) & 1) * 0x000000FF00000000ULL;
-    mask |= ((mskb >> 5) & 1) * 0x0000FF0000000000ULL;
-    mask |= ((mskb >> 6) & 1) * 0x00FF000000000000ULL;
-    mask |= ((mskb >> 7) & 1) * 0xFF00000000000000ULL;
-
-    return op & ~mask;
-}
+    mask  = -(mskb & 0x01) & 0x00000000000000ffull;
+    mask |= -(mskb & 0x02) & 0x000000000000ff00ull;
+    mask |= -(mskb & 0x04) & 0x0000000000ff0000ull;
+    mask |= -(mskb & 0x08) & 0x00000000ff000000ull;
+    mask |= -(mskb & 0x10) & 0x000000ff00000000ull;
+    mask |= -(mskb & 0x20) & 0x0000ff0000000000ull;
+    mask |= -(mskb & 0x40) & 0x00ff000000000000ull;
+    mask |= -(mskb & 0x80) & 0xff00000000000000ull;
 
-uint64_t helper_zap(uint64_t val, uint64_t mask)
-{
-    return byte_zap(val, mask);
+    return val & mask;
 }
 
-uint64_t helper_zapnot(uint64_t val, uint64_t mask)
+uint64_t helper_zap(uint64_t val, uint64_t mask)
 {
-    return byte_zap(val, ~mask);
+    return helper_zapnot(val, ~mask);
 }
 
 uint64_t helper_cmpbge(uint64_t op1, uint64_t op2)
Signature · 1 line
2.1.0
#0 lore raw

Having fixed the UL vs ULL fiasco in patch 17.

r~

The following changes since commit 385057cbec9b4a0eb6150330c572e875ed714965:

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-05-15' into staging (2015-05-15 17:51:20 +0100)

are available in the git repository at:

git://github.com/rth7680/qemu.git tags/pull-axp-20150521

for you to fetch changes up to 32ad48abd74a997220b841e4e913edeb267aa362:

target-alpha: Add vector implementation for CMPBGE (2015-05-21 10:34:18 -0700)

----------------------------------------------------------------
Rewrite fp exceptions

----------------------------------------------------------------
Richard Henderson (18):
target-alpha: Move VAX helpers to a new file
target-alpha: Rename floating-point subroutines
target-alpha: Forget installed round mode after MT_FPCR
target-alpha: Set PC correctly for floating-point exceptions
target-alpha: Tidy FPCR representation
target-alpha: Set fpcr_exc_status even for disabled exceptions
target-alpha: Set EXC_M_SWC for exceptions from /S insns
target-alpha: Raise IOV from CVTTQ
target-alpha: Fix cvttq vs large integers
target-alpha: Fix cvttq vs inf
target-alpha: Fix integer overflow checking insns
target-alpha: Implement WH64EN
target-alpha: Disallow literal operand to 1C.30 to 1C.37
target-alpha: Raise EXC_M_INV properly for fp inputs
target-alpha: Suppress underflow from CVTTQ if DNZ
target-alpha: Raise IOV from CVTQL
target-alpha: Rewrite helper_zapnot
target-alpha: Add vector implementation for CMPBGE

 target-alpha/Makefile.objs |   2 +-
 target-alpha/cpu.h         |  95 ++++----
 target-alpha/fpu_helper.c  | 530 +++++++++++----------------------------------
 target-alpha/helper.c      | 132 ++---------
 target-alpha/helper.h      |  14 +-
 target-alpha/int_helper.c  | 126 +++++------
 target-alpha/mem_helper.c  |   9 +-
 target-alpha/translate.c   | 265 ++++++++++++-----------
 target-alpha/vax_helper.c  | 353 ++++++++++++++++++++++++++++++
 9 files changed, 752 insertions(+), 774 deletions(-)
 create mode 100644 target-alpha/vax_helper.c
#2 lore raw
Quoted 1 line · Richard Henderson

Having fixed the UL vs ULL fiasco in patch 17.

...you seem to have changed the implementation too? The previous pull used sextract64().

-- PMM

#3 lore raw
Quoted 5 lines · Peter Maydell
Quoted 1 line · Richard Henderson

Having fixed the UL vs ULL fiasco in patch 17.

...you seem to have changed the implementation too? The previous pull used sextract64().

Yes. This is the same number of insns on x86_64, but doesn't overcommit the shifter. I should have mentioned.

r~

#4 lore raw
In reply to Richard Henderson
Quoted 10 lines · Richard Henderson

Having fixed the UL vs ULL fiasco in patch 17.

r~

The following changes since commit 385057cbec9b4a0eb6150330c572e875ed714965:

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-05-15' into staging (2015-05-15 17:51:20 +0100)

Quoted 7 lines

are available in the git repository at:

git://github.com/rth7680/qemu.git tags/pull-axp-20150521

for you to fetch changes up to 32ad48abd74a997220b841e4e913edeb267aa362:

target-alpha: Add vector implementation for CMPBGE (2015-05-21 10:34:18 -0700)

Applied, thanks.

-- PMM

#5 lore raw
Quoted 6 lines · Peter Maydell
Quoted 3 lines · Richard Henderson

for you to fetch changes up to 32ad48abd74a997220b841e4e913edeb267aa362:

target-alpha: Add vector implementation for CMPBGE (2015-05-21 10:34:18 -0700)

Applied, thanks.

Except I failed to notice a test failure from one of my builds before pushing:

target-alpha/int_helper.c: In function 'helper_cmpbge':
target-alpha/int_helper.c:77: error: invalid operands to binary >= target-alpha/int_helper.c:79: error: subscripted value is neither array nor pointer

That's in the Centos5 build, which is
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)

Any suggestions?

I do note that this build target is basically obsolete anyway, because we're about to move to requiring glib 2.22, at which point Centos5 is officially Too Old. So maybe we just say "yeah, you need a newer gcc" ?

-- PMM

#6 lore raw
Quoted 16 lines · Peter Maydell
Quoted 6 lines · Peter Maydell
Quoted 3 lines · Richard Henderson

for you to fetch changes up to 32ad48abd74a997220b841e4e913edeb267aa362:

target-alpha: Add vector implementation for CMPBGE (2015-05-21 10:34:18 -0700)

Applied, thanks.

Except I failed to notice a test failure from one of my builds before pushing:

target-alpha/int_helper.c: In function 'helper_cmpbge':
target-alpha/int_helper.c:77: error: invalid operands to binary >= target-alpha/int_helper.c:79: error: subscripted value is neither array nor pointer

Quoted 8 lines

That's in the Centos5 build, which is
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)

Any suggestions?

I do note that this build target is basically obsolete anyway, because we're about to move to requiring glib 2.22, at which point Centos5 is officially Too Old. So maybe we just say "yeah, you need a newer gcc" ?

Hmm. This fails on some of the travis builds too, with slightly different warnings:

gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 target-alpha/int_helper.c:77:24: error: invalid operands to binary >= (have '__vector(16) unsigned char' and '__vector(16) unsigned char')

I think the best thing to do for the moment is to revert commit 32ad48abd74a9 so we can get trunk building again, so I'm going to do that.

thanks
-- PMM

#7 lore raw
Quoted 29 lines · Peter Maydell
Quoted 16 lines · Peter Maydell
Quoted 6 lines · Peter Maydell
Quoted 3 lines · Richard Henderson

for you to fetch changes up to 32ad48abd74a997220b841e4e913edeb267aa362:

target-alpha: Add vector implementation for CMPBGE (2015-05-21 10:34:18 -0700)

Applied, thanks.

Except I failed to notice a test failure from one of my builds before pushing:

target-alpha/int_helper.c: In function 'helper_cmpbge':
target-alpha/int_helper.c:77: error: invalid operands to binary >= target-alpha/int_helper.c:79: error: subscripted value is neither array nor pointer

Quoted 8 lines

That's in the Centos5 build, which is
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)

Any suggestions?

I do note that this build target is basically obsolete anyway, because we're about to move to requiring glib 2.22, at which point Centos5 is officially Too Old. So maybe we just say "yeah, you need a newer gcc" ?

Hmm. This fails on some of the travis builds too, with slightly different warnings:

Quoted 7 lines

gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 target-alpha/int_helper.c:77:24: error: invalid operands to binary >= (have '__vector(16) unsigned char' and '__vector(16) unsigned char')

I think the best thing to do for the moment is to revert commit 32ad48abd74a9 so we can get trunk building again, so I'm going to do that.

Wow, I would have thought 4.6 would have been new enough. Sorry for the headache. Yes, a revert is probably best until I can figure out what versions do what.

r~