Skip to content

Commit 1b2bc1b

Browse files
committed
PR7774: Fix undefined shifts in Alpha backend. As a bonus, this actually
improves the generated code in some cases. llvm-svn: 109985
1 parent 47e4093 commit 1b2bc1b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ namespace {
113113
static uint64_t getNearPower2(uint64_t x) {
114114
if (!x) return 0;
115115
unsigned at = CountLeadingZeros_64(x);
116-
uint64_t complow = 1 << (63 - at);
117-
uint64_t comphigh = 1 << (64 - at);
116+
uint64_t complow = 1ULL << (63 - at);
117+
uint64_t comphigh = 1ULL << (64 - at);
118118
//cerr << x << ":" << complow << ":" << comphigh << "\n";
119119
if (abs64(complow - x) <= abs64(comphigh - x))
120120
return complow;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; RUN: llc < %s -march=alpha | FileCheck %s
2+
3+
define fastcc i64 @getcount(i64 %s) {
4+
%tmp431 = mul i64 %s, 12884901888
5+
ret i64 %tmp431
6+
}
7+
8+
; CHECK: sll $16,33,$0
9+
; CHECK-NEXT: sll $16,32,$1
10+
; CHECK-NEXT: addq $0,$1,$0
11+

0 commit comments

Comments
 (0)