LLVM 20.0.0git
|
Magic data for optimising signed division by a constant. More...
#include "llvm/Support/DivisionByConstantInfo.h"
Static Public Member Functions | |
static SignedDivisionByConstantInfo | get (const APInt &D) |
Calculate the magic numbers required to implement a signed integer division by a constant as a sequence of multiplies, adds and shifts. | |
Public Attributes | |
APInt | Magic |
magic number | |
unsigned | ShiftAmount |
shift amount | |
Magic data for optimising signed division by a constant.
Definition at line 21 of file DivisionByConstantInfo.h.
|
static |
Calculate the magic numbers required to implement a signed integer division by a constant as a sequence of multiplies, adds and shifts.
Requires that the divisor not be 0, 1, or -1. Taken from "Hacker's Delight", Henry S. Warren, Jr., Chapter 10.
Definition at line 21 of file DivisionByConstantInfo.cpp.
References assert(), D, llvm::APInt::getSignedMinValue(), llvm::APInt::isZero(), Magic, llvm::APInt::negate(), P, R2, ShiftAmount, llvm::APInt::udivrem(), llvm::APInt::uge(), and llvm::APInt::ult().
Referenced by llvm::TargetLowering::BuildSDIV().
APInt llvm::SignedDivisionByConstantInfo::Magic |
magic number
Definition at line 23 of file DivisionByConstantInfo.h.
Referenced by llvm::TargetLowering::BuildSDIV(), and get().
unsigned llvm::SignedDivisionByConstantInfo::ShiftAmount |
shift amount
Definition at line 24 of file DivisionByConstantInfo.h.
Referenced by llvm::TargetLowering::BuildSDIV(), and get().