llvm.org GIT mirror llvm / 99d28c4
Revert r235869 - [mips] Avoid redundant sign extension of the result of binary bitwise instructions. It introduced two regressions (MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4, and MultiSource/Applications/kimwitu++/kc) on 3 out of 23 cross-compilation test-runs used by Mips for release validation. The issue is that on 64-bit targets comparisons such as BEQ compare the whole GPR64 but incorrectly tell the instruction selector that they operate on GPR32's. This leads to the elimination of i32->i64 extensions that are actually required by comparisons to work correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_36@237432 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Sanders 4 years ago
4 changed file(s) with 13 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
426426 (EXTRACT_SUBREG GPR64:$src, sub_32)>;
427427 def : MipsPat<(i32 (trunc GPR64:$src)),
428428 (SLL (EXTRACT_SUBREG GPR64:$src, sub_32), 0)>;
429
430 // Bypass trunc nodes for bitwise ops.
431 def : MipsPat<(i32 (trunc (and GPR64:$lhs, GPR64:$rhs))),
432 (EXTRACT_SUBREG (AND64 GPR64:$lhs, GPR64:$rhs), sub_32)>;
433 def : MipsPat<(i32 (trunc (or GPR64:$lhs, GPR64:$rhs))),
434 (EXTRACT_SUBREG (OR64 GPR64:$lhs, GPR64:$rhs), sub_32)>;
435 def : MipsPat<(i32 (trunc (xor GPR64:$lhs, GPR64:$rhs))),
436 (EXTRACT_SUBREG (XOR64 GPR64:$lhs, GPR64:$rhs), sub_32)>;
437429
438430 // 32-to-64-bit extension
439431 def : MipsPat<(i64 (anyext GPR32:$src)), (SLL64_32 GPR32:$src)>;
5050 entry:
5151 ; ALL-LABEL: and_i32:
5252
53 ; ALL: and $2, $4, $5
53 ; GP32: and $2, $4, $5
54
55 ; GP64: and $[[T0:[0-9]+]], $4, $5
56 ; GP64: sll $2, $[[T0]], 0
5457
5558 %r = and i32 %a, %b
5659 ret i32 %r
5050 entry:
5151 ; ALL-LABEL: or_i32:
5252
53 ; ALL: or $2, $4, $5
53 ; GP32: or $2, $4, $5
54
55 ; GP64: or $[[T0:[0-9]+]], $4, $5
56 ; FIXME: The sll instruction below is redundant.
57 ; GP64: sll $2, $[[T0]], 0
5458
5559 %r = or i32 %a, %b
5660 ret i32 %r
5050 entry:
5151 ; ALL-LABEL: xor_i32:
5252
53 ; ALL: xor $2, $4, $5
53 ; GP32: xor $2, $4, $5
54
55 ; GP64: xor $[[T0:[0-9]+]], $4, $5
56 ; GP64: sll $2, $[[T0]], 0
5457
5558 %r = xor i32 %a, %b
5659 ret i32 %r