Skip to content

Commit aafc04f

Browse files
committed
s390x: simplify ceil/floor code
The previous change[1] to this code left quite a bit of dead code behind, when it switched vm_round from using DIDBR (divide to integer) to FIDBR (load floating-point integer). Simplify the code by removing the remains of the previous implementation. As a side effect, math.ceil() etc. now execute without crashing in QEMU, which was previously not the case because QEMU doesn't implement DIDBR. [1]: openresty#177
1 parent ea25ac1 commit aafc04f

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/vm_s390x.dasc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,16 +2126,8 @@ static void build_subroutines(BuildCtx *ctx)
21262126
|// Value to round is in f0. May clobber f0-f7 and r0. Return address is r14.
21272127
|.macro vm_round, name, mask
21282128
|->name:
2129-
| ldr f4, f0
2130-
| lghi r0, 1
2131-
| cdfbr f1, r0
2132-
| didbr f0, f2, f1, mask // f0=remainder, f2=quotient.
2133-
| fidbra f4, mask, f4, 0
2134-
| ldr f0, f4
2135-
| jnle >1
2129+
| fidbra f0, mask, f0, 0
21362130
| br r14
2137-
|1: // partial remainder (sanity check)
2138-
| stg r0, 0
21392131
|.endmacro
21402132
|
21412133
| vm_round vm_floor, 7 // Round towards -inf.

0 commit comments

Comments
 (0)