aboutsummaryrefslogtreecommitdiff
path: root/softfloat/f32_sub.c
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2017-09-24 20:25:34 -0700
committerAndrew Waterman <andrew@sifive.com>2017-09-24 20:25:34 -0700
commitbd85811c35ea38180d27440507fc222d585ef780 (patch)
tree214c6b615d7775f73da5ff9a94bd4a0a2772f9cf /softfloat/f32_sub.c
parentb86f2a51f522f020ad0d90f598f4c501f41da232 (diff)
downloadspike-bd85811c35ea38180d27440507fc222d585ef780.zip
spike-bd85811c35ea38180d27440507fc222d585ef780.tar.gz
spike-bd85811c35ea38180d27440507fc222d585ef780.tar.bz2
Update SoftFloat
Diffstat (limited to 'softfloat/f32_sub.c')
-rw-r--r--softfloat/f32_sub.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/softfloat/f32_sub.c b/softfloat/f32_sub.c
index eae436c..d830738 100644
--- a/softfloat/f32_sub.c
+++ b/softfloat/f32_sub.c
@@ -2,10 +2,10 @@
/*============================================================================
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
-Package, Release 3a, by John R. Hauser.
+Package, Release 3d, by John R. Hauser.
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -44,30 +44,26 @@ float32_t f32_sub( float32_t a, float32_t b )
{
union ui32_f32 uA;
uint_fast32_t uiA;
- bool signA;
union ui32_f32 uB;
uint_fast32_t uiB;
- bool signB;
#if ! defined INLINE_LEVEL || (INLINE_LEVEL < 1)
- float32_t (*magsFuncPtr)( uint_fast32_t, uint_fast32_t, bool );
+ float32_t (*magsFuncPtr)( uint_fast32_t, uint_fast32_t );
#endif
uA.f = a;
uiA = uA.ui;
- signA = signF32UI( uiA );
uB.f = b;
uiB = uB.ui;
- signB = signF32UI( uiB );
#if defined INLINE_LEVEL && (1 <= INLINE_LEVEL)
- if ( signA == signB ) {
- return softfloat_subMagsF32( uiA, uiB, signA );
+ if ( signF32UI( uiA ^ uiB ) ) {
+ return softfloat_addMagsF32( uiA, uiB );
} else {
- return softfloat_addMagsF32( uiA, uiB, signA );
+ return softfloat_subMagsF32( uiA, uiB );
}
#else
magsFuncPtr =
- (signA == signB) ? softfloat_subMagsF32 : softfloat_addMagsF32;
- return (*magsFuncPtr)( uiA, uiB, signA );
+ signF32UI( uiA ^ uiB ) ? softfloat_addMagsF32 : softfloat_subMagsF32;
+ return (*magsFuncPtr)( uiA, uiB );
#endif
}