Module: Mesa Branch: master Commit: 0298238bdd65344b91731973902fb46530e74cca URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0298238bdd65344b91731973902fb46530e74cca
Author: Vadim Girlin <[email protected]> Date: Tue May 15 18:47:53 2012 +0400 radeon/llvm: improve ABS_i32 lowering We can save one instruction by lowering it to: SUB_INT tmp, 0, src MAX_INT dst, src, tmp Signed-off-by: Vadim Girlin <[email protected]> Reviewed-by: Tom Stellard <[email protected]> --- .../drivers/radeon/R600LowerInstructions.cpp | 18 +++++------------- 1 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/radeon/R600LowerInstructions.cpp b/src/gallium/drivers/radeon/R600LowerInstructions.cpp index 41bf365..42c9766 100644 --- a/src/gallium/drivers/radeon/R600LowerInstructions.cpp +++ b/src/gallium/drivers/radeon/R600LowerInstructions.cpp @@ -90,24 +90,16 @@ bool R600LowerInstructionsPass::runOnMachineFunction(MachineFunction &MF) case AMDIL::ABS_i32: { - unsigned setgt = MRI->createVirtualRegister( + unsigned neg = MRI->createVirtualRegister( &AMDIL::R600_TReg32RegClass); - BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(AMDIL::SETGE_INT), - setgt) + BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(AMDIL::SUB_INT),neg) .addReg(AMDIL::ZERO) .addOperand(MI.getOperand(1)); - unsigned add_int = MRI->createVirtualRegister( - &AMDIL::R600_TReg32RegClass); - BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(AMDIL::ADD_INT), - add_int) - .addReg(setgt) - .addOperand(MI.getOperand(1)); - - BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(AMDIL::XOR_INT)) + BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(AMDIL::MAX_INT)) .addOperand(MI.getOperand(0)) - .addReg(setgt) - .addReg(add_int); + .addOperand(MI.getOperand(1)) + .addReg(neg); break; } _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
