Bad compilation of rotate-byte with constant rotation count
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Hello,
I'm using the sb-rotate-
Rotating a 32-bit unsigned integer to the left works:
(defun rol32-3 (a)
(declare (type (unsigned-byte 32) a))
(sb-rotate-
(disassemble 'rol32-3)
; disassembly for ROL32-3
; Size: 29 bytes. Origin: #x1004D0946A
; 6A: 498B4C2460 MOV RCX, [R12+96] ; thread.
; 6F: 48894DF8 MOV [RBP-8], RCX
; 73: 488BD3 MOV RDX, RBX
; 76: 48D1FA SAR RDX, 1
; 79: C1C203 ROL EDX, 3
; 7C: 48D1E2 SHL RDX, 1
; 7F: 488BE5 MOV RSP, RBP
; 82: F8 CLC
; 83: 5D POP RBP
; 84: C3 RET
; 85: CC10 BREAK 16 ; Invalid argument count trap
But rotating a 32-bit unsigned integer to the right doesn't give the right result:
(defun ror32-3 (a)
(declare (type (unsigned-byte 32) a))
(sb-rotate-
(disassemble 'ror32-3)
; disassembly for ROR32-3
; Size: 29 bytes. Origin: #x1004D2E30A
; 0A: 498B4C2460 MOV RCX, [R12+96] ; thread.
; 0F: 48894DF8 MOV [RBP-8], RCX
; 13: 488BD3 MOV RDX, RBX
; 16: 48D1FA SAR RDX, 1
; 19: C1CAFD ROR EDX, 253
; 1C: 48D1E2 SHL RDX, 1
; 1F: 488BE5 MOV RSP, RBP
; 22: F8 CLC
; 23: 5D POP RBP
; 24: C3 RET
; 25: CC10 BREAK 16 ; Invalid argument count trap
Here we have a "ROR EDX, 253" instead of "ROR EDX, 3".
Changed in sbcl: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
In d457a3c61e7612f dbfb9afb76fbd26 7fbe4444ad.