LLVM: include/llvm/Support/ScaledNumber.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21#ifndef LLVM_SUPPORT_SCALEDNUMBER_H

22#define LLVM_SUPPORT_SCALEDNUMBER_H

23

26#include

27#include

28#include

29#include

30#include

31#include

32

33namespace llvm {

35

36

38

39

41

42

43template inline int getWidth() { return sizeof(DigitsT) * 8; }

44

45

46

47

48

49

50

51

52template

53inline std::pair<DigitsT, int16_t> getRounded(DigitsT Digits, int16_t Scale,

54 bool ShouldRound) {

55 static_assert(!std::numeric_limits::is_signed, "expected unsigned");

56

57 if (ShouldRound)

58 if (!++Digits)

59

61 return {Digits, Scale};

62}

63

64

66 bool ShouldRound) {

67 return getRounded(Digits, Scale, ShouldRound);

68}

69

70

72 bool ShouldRound) {

73 return getRounded(Digits, Scale, ShouldRound);

74}

75

76

77

78

79template

81 int16_t Scale = 0) {

82 static_assert(!std::numeric_limits::is_signed, "expected unsigned");

83

85 if (Width == 64 || Digits <= std::numeric_limits::max())

86 return {Digits, Scale};

87

88

91 Digits & (UINT64_C(1) << (Shift - 1)));

92}

93

94

96 int16_t Scale = 0) {

98}

99

100

102 int16_t Scale = 0) {

104}

105

106

107

108

110

111

112

113

114template

116 static_assert(!std::numeric_limits::is_signed, "expected unsigned");

117

120

122}

123

124

128

129

133

134

135

136

137

138

141

142

143

144

145

146

149

150

151

152

153

154

155template

156std::pair<DigitsT, int16_t> getQuotient(DigitsT Dividend, DigitsT Divisor) {

157 static_assert(!std::numeric_limits::is_signed, "expected unsigned");

158 static_assert(sizeof(DigitsT) == 4 || sizeof(DigitsT) == 8,

159 "expected 32-bit or 64-bit digits");

160

161

162 if (!Dividend)

163 return {0, 0};

164 if (!Divisor)

165 return {std::numeric_limits::max(), MaxScale};

166

168 return divide64(Dividend, Divisor);

169 return divide32(Dividend, Divisor);

170}

171

172

177

178

183

184

185

186

187

188

189

190template

191inline std::pair<int32_t, int> getLgImpl(DigitsT Digits, int16_t Scale) {

192 static_assert(!std::numeric_limits::is_signed, "expected unsigned");

193

194 if (!Digits)

195 return {INT32_MIN, 0};

196

197

198 static_assert(sizeof(Digits) <= sizeof(uint64_t));

200

201

202 int32_t Floor = Scale + LocalFloor;

203 if (Digits == UINT64_C(1) << LocalFloor)

204 return {Floor, 0};

205

206

207 assert(LocalFloor >= 1);

208 bool Round = Digits & UINT64_C(1) << (LocalFloor - 1);

209 return {Floor + Round, Round ? 1 : -1};

210}

211

212

213

214

215

216

217template int32_t getLg(DigitsT Digits, int16_t Scale) {

218 return getLgImpl(Digits, Scale).first;

219}

220

221

222

223

224

225

226template int32_t getLgFloor(DigitsT Digits, int16_t Scale) {

227 auto Lg = getLgImpl(Digits, Scale);

228 return Lg.first - (Lg.second > 0);

229}

230

231

232

233

234

235

236template int32_t getLgCeiling(DigitsT Digits, int16_t Scale) {

237 auto Lg = getLgImpl(Digits, Scale);

238 return Lg.first + (Lg.second < 0);

239}

240

241

242

243

244

245

246

247

249

250

251

252

253

254template

255int compare(DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale) {

256 static_assert(!std::numeric_limits::is_signed, "expected unsigned");

257

258

259 if (!LDigits)

260 return RDigits ? -1 : 0;

261 if (!RDigits)

262 return 1;

263

264

265

266 int32_t lgL = getLgFloor(LDigits, LScale), lgR = getLgFloor(RDigits, RScale);

267 if (lgL != lgR)

268 return lgL < lgR ? -1 : 1;

269

270

271 if (LScale < RScale)

272 return compareImpl(LDigits, RDigits, RScale - LScale);

273

274 return -compareImpl(RDigits, LDigits, LScale - RScale);

275}

276

277

278

279

280

281

282

283

284

285

286

287

288

289template

290int16_t matchScales(DigitsT &LDigits, int16_t &LScale, DigitsT &RDigits,

291 int16_t &RScale) {

292 static_assert(!std::numeric_limits::is_signed, "expected unsigned");

293

294 if (LScale < RScale)

295

296 return matchScales(RDigits, RScale, LDigits, LScale);

297 if (!LDigits)

298 return RScale;

299 if (!RDigits || LScale == RScale)

300 return LScale;

301

302

303 int32_t ScaleDiff = int32_t(LScale) - RScale;

305

306 RDigits = 0;

307 return LScale;

308 }

309

310

311 int32_t ShiftL = std::min<int32_t>(llvm::countl_zero(LDigits), ScaleDiff);

313

314 int32_t ShiftR = ScaleDiff - ShiftL;

316

317 RDigits = 0;

318 return LScale;

319 }

320

321 LDigits <<= ShiftL;

322 RDigits >>= ShiftR;

323

324 LScale -= ShiftL;

325 RScale += ShiftR;

326 assert(LScale == RScale && "scales should match");

327 return LScale;

328}

329

330

331

332

333

334

335template

336std::pair<DigitsT, int16_t> getSum(DigitsT LDigits, int16_t LScale,

337 DigitsT RDigits, int16_t RScale) {

338 static_assert(!std::numeric_limits::is_signed, "expected unsigned");

339

340

341

342 assert(LScale < INT16_MAX && "scale too large");

343 assert(RScale < INT16_MAX && "scale too large");

344

345

346 int16_t Scale = matchScales(LDigits, LScale, RDigits, RScale);

347

348

349 DigitsT Sum = LDigits + RDigits;

350 if (Sum >= RDigits)

351 return {Sum, Scale};

352

353

355 return {HighBit | Sum >> 1, Scale + 1};

356}

357

358

359inline std::pair<uint32_t, int16_t> getSum32(uint32_t LDigits, int16_t LScale,

360 uint32_t RDigits, int16_t RScale) {

361 return getSum(LDigits, LScale, RDigits, RScale);

362}

363

364

365inline std::pair<uint64_t, int16_t> getSum64(uint64_t LDigits, int16_t LScale,

366 uint64_t RDigits, int16_t RScale) {

367 return getSum(LDigits, LScale, RDigits, RScale);

368}

369

370

371

372

373

374

375template

376std::pair<DigitsT, int16_t> getDifference(DigitsT LDigits, int16_t LScale,

377 DigitsT RDigits, int16_t RScale) {

378 static_assert(!std::numeric_limits::is_signed, "expected unsigned");

379

380

381 const DigitsT SavedRDigits = RDigits;

382 const int16_t SavedRScale = RScale;

383 matchScales(LDigits, LScale, RDigits, RScale);

384

385

386 if (LDigits <= RDigits)

387 return {0, 0};

388 if (RDigits || !SavedRDigits)

389 return {LDigits - RDigits, LScale};

390

391

392

393

394 const auto RLgFloor = getLgFloor(SavedRDigits, SavedRScale);

396 return {std::numeric_limits::max(), RLgFloor};

397

398 return {LDigits, LScale};

399}

400

401

403 int16_t LScale,

405 int16_t RScale) {

406 return getDifference(LDigits, LScale, RDigits, RScale);

407}

408

409

411 int16_t LScale,

413 int16_t RScale) {

414 return getDifference(LDigits, LScale, RDigits, RScale);

415}

416

417}

418}

419

420namespace llvm {

421

424public:

426

429 int Width, unsigned Precision);

431 unsigned Precision);

435

436 static std::pair<uint64_t, bool> splitSigned(int64_t N) {

437 if (N >= 0)

438 return {N, false};

441 }

445 return IsNeg ? -int64_t(U) : int64_t(U);

446 }

447};

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

497public:

498 static_assert(!std::numeric_limits::is_signed,

499 "only unsigned floats supported");

500

502

503private:

504 using DigitsLimits = std::numeric_limits;

505

506 static constexpr int Width = sizeof(DigitsType) * 8;

507 static_assert(Width <= 64, "invalid integer width for digits");

508

509private:

511 int16_t Scale = 0;

512

513public:

515

517 : Digits(Digits), Scale(Scale) {}

518

519private:

520 ScaledNumber(const std::pair<DigitsT, int16_t> &X)

521 : Digits(X.first), Scale(X.second) {}

522

523public:

534 return getQuotient(N, D);

535 }

536

537 int16_t getScale() const { return Scale; }

539

540

541

542

543

544 template IntT toInt() const;

545

546 bool isZero() const { return !Digits; }

549 if (Scale > 0 || Scale <= -Width)

550 return false;

551 return Digits == DigitsType(1) << -Scale;

552 }

553

554

555

556

558

559

560

561

563

564

565

566

570

577

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

602

603

604

605

611

613 std::tie(Digits, Scale) =

615

618 return *this;

619 }

621 std::tie(Digits, Scale) =

623 return *this;

624 }

628 shiftLeft(Shift);

629 return *this;

630 }

632 shiftRight(Shift);

633 return *this;

634 }

635

636private:

637 void shiftLeft(int32_t Shift);

639

640

641

642

643

644

645

646

649 return X;

650 }

651

652public:

653

654

655

656

671

679

682

683private:

686 }

689 }

690

691 static int countLeadingZerosWidth(DigitsType Digits) {

692 if (Width == 64)

694 if (Width == 32)

697 }

698

699

700

701

702

703

704 static ScaledNumber adjustToWidth(uint64_t N, int32_t Shift) {

707 "Shift should be close to 0");

709 return Adjusted;

710 }

711

713

714 if (P.isLargest())

715 return P;

716

718 }

719};

720

721#define SCALED_NUMBER_BOP(op, base) \

722 template \

723 ScaledNumber operator op(const ScaledNumber &L, \

724 const ScaledNumber &R) { \

725 return ScaledNumber(L) base R; \

726 }

731#undef SCALED_NUMBER_BOP

732

733template

734ScaledNumber operator<<(const ScaledNumber &L,

735 int16_t Shift) {

736 return ScaledNumber(L) <<= Shift;

737}

738

739template

741 int16_t Shift) {

743}

744

745template

747 return X.print(OS, 10);

748}

749

750#define SCALED_NUMBER_COMPARE_TO_TYPE(op, T1, T2) \

751 template \

752 bool operator op(const ScaledNumber &L, T1 R) { \

753 return L.compareTo(T2(R)) op 0; \

754 } \

755 template \

756 bool operator op(T1 L, const ScaledNumber &R) { \

757 return 0 op R.compareTo(T2(L)); \

758 }

759#define SCALED_NUMBER_COMPARE_TO(op) \

760 SCALED_NUMBER_COMPARE_TO_TYPE(op, uint64_t, uint64_t) \

761 SCALED_NUMBER_COMPARE_TO_TYPE(op, uint32_t, uint64_t) \

762 SCALED_NUMBER_COMPARE_TO_TYPE(op, int64_t, int64_t) \

763 SCALED_NUMBER_COMPARE_TO_TYPE(op, int32_t, int64_t)

770#undef SCALED_NUMBER_COMPARE_TO

771#undef SCALED_NUMBER_COMPARE_TO_TYPE

772

773template

775 if (Width == 64 || N <= DigitsLimits::max())

777

778

780}

781

782template

783template

785 using Limits = std::numeric_limits;

786 if (*this < 1)

787 return 0;

788 if (*this >= Limits::max())

789 return Limits::max();

790

791 IntT N = Digits;

792 if (Scale > 0) {

793 assert(size_t(Scale) < sizeof(IntT) * 8);

794 return N << Scale;

795 }

796 if (Scale < 0) {

797 assert(size_t(-Scale) < sizeof(IntT) * 8);

798 return N >> -Scale;

799 }

800 return N;

801}

802

803template

807 return *this;

808 if (X.isZero())

809 return *this = X;

810

811

812 int32_t Scales = int32_t(Scale) + int32_t(X.Scale);

813

814

815 *this = getProduct(Digits, X.Digits);

816

817

818 return *this <<= Scales;

819}

820template

824 return *this;

825 if (X.isZero())

827

828

829 int32_t Scales = int32_t(Scale) - int32_t(X.Scale);

830

831

832 *this = getQuotient(Digits, X.Digits);

833

834

835 return *this <<= Scales;

836}

837template void ScaledNumber::shiftLeft(int32_t Shift) {

838 if (!Shift || isZero())

839 return;

840 assert(Shift != INT32_MIN);

841 if (Shift < 0) {

843 return;

844 }

845

846

848 Scale += ScaleShift;

849 if (ScaleShift == Shift)

850 return;

851

852

853 if (isLargest())

854 return;

855

856

857 Shift -= ScaleShift;

858 if (Shift > countLeadingZerosWidth(Digits)) {

859

860 *this = getLargest();

861 return;

862 }

863

864 Digits <<= Shift;

865}

866

867template void ScaledNumber::shiftRight(int32_t Shift) {

868 if (!Shift || isZero())

869 return;

870 assert(Shift != INT32_MIN);

871 if (Shift < 0) {

872 shiftLeft(-Shift);

873 return;

874 }

875

876

878 Scale -= ScaleShift;

879 if (ScaleShift == Shift)

880 return;

881

882

883 Shift -= ScaleShift;

884 if (Shift >= Width) {

885

886 *this = getZero();

887 return;

888 }

889

890 Digits >>= Shift;

891}

892

893

894}

895

896#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

static bool isZero(Value *V, const DataLayout &DL, DominatorTree *DT, AssumptionCache *AC)

#define SCALED_NUMBER_BOP(op, base)

Definition ScaledNumber.h:721

#define SCALED_NUMBER_COMPARE_TO(op)

Definition ScaledNumber.h:759

static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")

Definition ScaledNumber.h:423

static int countLeadingZeros64(uint64_t N)

Definition ScaledNumber.h:433

static int countLeadingZeros32(uint32_t N)

Definition ScaledNumber.h:432

static constexpr int DefaultPrecision

Definition ScaledNumber.h:425

static int64_t joinSigned(uint64_t U, bool IsNeg)

Definition ScaledNumber.h:442

static LLVM_ABI raw_ostream & print(raw_ostream &OS, uint64_t D, int16_t E, int Width, unsigned Precision)

static LLVM_ABI std::string toString(uint64_t D, int16_t E, int Width, unsigned Precision)

static LLVM_ABI void dump(uint64_t D, int16_t E, int Width)

static uint64_t getHalf(uint64_t N)

Definition ScaledNumber.h:434

static std::pair< uint64_t, bool > splitSigned(int64_t N)

Definition ScaledNumber.h:436

Simple representation of a scaled number.

Definition ScaledNumber.h:496

bool operator!=(const ScaledNumber &X) const

Definition ScaledNumber.h:573

bool isZero() const

Definition ScaledNumber.h:546

raw_ostream & print(raw_ostream &OS, unsigned Precision=DefaultPrecision) const

Print a decimal representation.

Definition ScaledNumber.h:606

ScaledNumber & operator*=(const ScaledNumber &X)

Definition ScaledNumber.h:805

static ScaledNumber getLargest()

Definition ScaledNumber.h:526

ScaledNumber & operator/=(const ScaledNumber &X)

Definition ScaledNumber.h:822

ScaledNumber & operator<<=(int16_t Shift)

Definition ScaledNumber.h:627

uint64_t DigitsType

Definition ScaledNumber.h:501

int32_t lgFloor() const

The log base 2, rounded towards INT32_MIN.

Definition ScaledNumber.h:562

ScaledNumber inverse() const

Definition ScaledNumber.h:681

bool operator<=(const ScaledNumber &X) const

Definition ScaledNumber.h:575

ScaledNumber & operator+=(const ScaledNumber &X)

Definition ScaledNumber.h:612

bool operator==(const ScaledNumber &X) const

Definition ScaledNumber.h:571

int compare(const ScaledNumber &X) const

Definition ScaledNumber.h:672

bool isOne() const

Definition ScaledNumber.h:548

std::string toString(unsigned Precision=DefaultPrecision)

Convert to a decimal representation in a string.

Definition ScaledNumber.h:599

void dump() const

Definition ScaledNumber.h:610

static ScaledNumber get(uint64_t N)

Definition ScaledNumber.h:529

static ScaledNumber getZero()

Definition ScaledNumber.h:524

DigitsType getDigits() const

Definition ScaledNumber.h:538

static ScaledNumber getOne()

Definition ScaledNumber.h:525

uint64_t scale(uint64_t N) const

Scale a large number accurately.

Definition ScaledNumber.h:774

bool operator>(const ScaledNumber &X) const

Definition ScaledNumber.h:574

ScaledNumber & operator>>=(int16_t Shift)

Definition ScaledNumber.h:631

static ScaledNumber getFraction(DigitsType N, DigitsType D)

Definition ScaledNumber.h:533

int64_t scaleByInverse(int64_t N) const

Definition ScaledNumber.h:667

constexpr ScaledNumber(DigitsType Digits, int16_t Scale)

Definition ScaledNumber.h:516

int32_t lgCeiling() const

The log base 2, rounded towards INT32_MAX.

Definition ScaledNumber.h:567

uint64_t scaleByInverse(uint64_t N) const

Definition ScaledNumber.h:658

bool operator!() const

Definition ScaledNumber.h:578

ScaledNumber & invert()

Definition ScaledNumber.h:680

bool operator<(const ScaledNumber &X) const

Definition ScaledNumber.h:572

bool operator>=(const ScaledNumber &X) const

Definition ScaledNumber.h:576

int32_t lg() const

The log base 2, rounded.

Definition ScaledNumber.h:557

int compareTo(uint64_t N) const

Definition ScaledNumber.h:675

static ScaledNumber getInverse(uint64_t N)

Definition ScaledNumber.h:530

IntT toInt() const

Convert to the given integer type.

Definition ScaledNumber.h:784

bool isLargest() const

Definition ScaledNumber.h:547

ScaledNumber & operator-=(const ScaledNumber &X)

Definition ScaledNumber.h:620

int64_t scale(int64_t N) const

Definition ScaledNumber.h:663

int16_t getScale() const

Definition ScaledNumber.h:537

int compareTo(int64_t N) const

Definition ScaledNumber.h:678

This class implements an extremely fast bulk output stream that can only output to a stream.

Definition ScaledNumber.h:34

int compare(DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale)

Compare two scaled numbers.

Definition ScaledNumber.h:255

LLVM_ABI std::pair< uint64_t, int16_t > divide64(uint64_t Dividend, uint64_t Divisor)

Divide two 64-bit integers to create a 64-bit scaled number.

int32_t getLgFloor(DigitsT Digits, int16_t Scale)

Get the lg floor of a scaled number.

Definition ScaledNumber.h:226

LLVM_ABI std::pair< uint64_t, int16_t > multiply64(uint64_t LHS, uint64_t RHS)

Multiply two 64-bit integers to create a 64-bit scaled number.

std::pair< DigitsT, int16_t > getSum(DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale)

Get the sum of two scaled numbers.

Definition ScaledNumber.h:336

std::pair< uint32_t, int16_t > getAdjusted32(uint64_t Digits, int16_t Scale=0)

Convenience helper for adjusting to 32 bits.

Definition ScaledNumber.h:95

const int32_t MinScale

Maximum scale; same as APFloat for easy debug printing.

Definition ScaledNumber.h:40

std::pair< DigitsT, int16_t > getAdjusted(uint64_t Digits, int16_t Scale=0)

Adjust a 64-bit scaled number down to the appropriate width.

Definition ScaledNumber.h:80

std::pair< uint64_t, int16_t > getAdjusted64(uint64_t Digits, int16_t Scale=0)

Convenience helper for adjusting to 64 bits.

Definition ScaledNumber.h:101

std::pair< uint32_t, int16_t > getQuotient32(uint32_t Dividend, uint32_t Divisor)

Convenience helper for 32-bit quotient.

Definition ScaledNumber.h:173

std::pair< int32_t, int > getLgImpl(DigitsT Digits, int16_t Scale)

Implementation of getLg() and friends.

Definition ScaledNumber.h:191

std::pair< uint32_t, int16_t > getSum32(uint32_t LDigits, int16_t LScale, uint32_t RDigits, int16_t RScale)

Convenience helper for 32-bit sum.

Definition ScaledNumber.h:359

std::pair< DigitsT, int16_t > getProduct(DigitsT LHS, DigitsT RHS)

Multiply two 32-bit integers to create a 32-bit scaled number.

Definition ScaledNumber.h:115

std::pair< DigitsT, int16_t > getRounded(DigitsT Digits, int16_t Scale, bool ShouldRound)

Conditionally round up a scaled number.

Definition ScaledNumber.h:53

std::pair< uint32_t, int16_t > getDifference32(uint32_t LDigits, int16_t LScale, uint32_t RDigits, int16_t RScale)

Convenience helper for 32-bit difference.

Definition ScaledNumber.h:402

std::pair< uint64_t, int16_t > getQuotient64(uint64_t Dividend, uint64_t Divisor)

Convenience helper for 64-bit quotient.

Definition ScaledNumber.h:179

std::pair< uint32_t, int16_t > getRounded32(uint32_t Digits, int16_t Scale, bool ShouldRound)

Convenience helper for 32-bit rounding.

Definition ScaledNumber.h:65

int16_t matchScales(DigitsT &LDigits, int16_t &LScale, DigitsT &RDigits, int16_t &RScale)

Match scales of two numbers.

Definition ScaledNumber.h:290

LLVM_ABI std::pair< uint32_t, int16_t > divide32(uint32_t Dividend, uint32_t Divisor)

Divide two 32-bit integers to create a 32-bit scaled number.

const int32_t MaxScale

Maximum scale; same as APFloat for easy debug printing.

Definition ScaledNumber.h:37

std::pair< uint32_t, int16_t > getProduct32(uint32_t LHS, uint32_t RHS)

Convenience helper for 32-bit product.

Definition ScaledNumber.h:125

int32_t getLg(DigitsT Digits, int16_t Scale)

Get the lg (rounded) of a scaled number.

Definition ScaledNumber.h:217

std::pair< uint64_t, int16_t > getSum64(uint64_t LDigits, int16_t LScale, uint64_t RDigits, int16_t RScale)

Convenience helper for 64-bit sum.

Definition ScaledNumber.h:365

std::pair< DigitsT, int16_t > getDifference(DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale)

Get the difference of two scaled numbers.

Definition ScaledNumber.h:376

std::pair< DigitsT, int16_t > getQuotient(DigitsT Dividend, DigitsT Divisor)

Divide two 32-bit numbers to create a 32-bit scaled number.

Definition ScaledNumber.h:156

LLVM_ABI int compareImpl(uint64_t L, uint64_t R, int ScaleDiff)

Implementation for comparing scaled numbers.

int getWidth()

Get the width of a number.

Definition ScaledNumber.h:43

std::pair< uint64_t, int16_t > getDifference64(uint64_t LDigits, int16_t LScale, uint64_t RDigits, int16_t RScale)

Convenience helper for 64-bit difference.

Definition ScaledNumber.h:410

int32_t getLgCeiling(DigitsT Digits, int16_t Scale)

Get the lg ceiling of a scaled number.

Definition ScaledNumber.h:236

std::pair< uint64_t, int16_t > getRounded64(uint64_t Digits, int16_t Scale, bool ShouldRound)

Convenience helper for 64-bit rounding.

Definition ScaledNumber.h:71

std::pair< uint64_t, int16_t > getProduct64(uint64_t LHS, uint64_t RHS)

Convenience helper for 64-bit product.

Definition ScaledNumber.h:130

This is an optimization pass for GlobalISel generic memory operations.

int bit_width(T Value)

Returns the number of bits needed to represent Value if Value is nonzero.

unsigned Log2_64(uint64_t Value)

Return the floor log base 2 of the specified value, -1 if the value is zero.

int countl_zero(T Val)

Count number of 0's from the most significant bit to the least stopping at the first 1.

decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)

static lostFraction shiftRight(APFloatBase::integerPart *dst, unsigned int parts, unsigned int bits)

raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)

ScaledNumber< DigitsT > operator>>(const ScaledNumber< DigitsT > &L, int16_t Shift)

Definition ScaledNumber.h:740