1. Van Lindberg
  2. pypy

Commits

edelsohn  committed 21ca802

Use rlwinm for PPC32 zero-extend

  • Participants
  • Parent commits 058e97b
  • Branches ppc-jit-backend

Comments (0)

Files changed (1)

File pypy/jit/backend/ppc/ppcgen/ppc_assembler.py

View file
         if size == 1:
             if not signed: #unsigned char
                 if IS_PPC32:
-                    self.mc.load_imm(r.r0, 0xFF)
-                    self.mc.and_(resloc.value, resloc.value, r.r0.value)
+                    self.mc.rlwinm(resloc.value, resloc.value, 0, 24, 31)
                 else:
                     self.mc.rldicl(resloc.value, resloc.value, 0, 56)
             else:
         elif size == 2:
             if not signed:
                 if IS_PPC_32:
-                    self.mc.load_imm(r.r0, 16)
-                    self.mc.slw(resloc.value, resloc.value, r.r0.value)
-                    self.mc.srw(resloc.value, resloc.value, r.r0.value)
+                    self.mc.rlwinm(resloc.value, resloc.value, 0, 16, 31)
                 else:
                     self.mc.rldicl(resloc.value, resloc.value, 0, 48)
             else: