2017-01-13 03:29:18 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2017-01-13 03:48:01 +08:00
|
|
|
; Check that 64-bit division is bypassed correctly.
|
|
|
|
; RUN: llc < %s -mattr=+idivq-to-divl -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
|
2013-03-05 02:13:57 +08:00
|
|
|
|
|
|
|
; Additional tests for 64-bit divide bypass
|
|
|
|
|
|
|
|
define i64 @Test_get_quotient(i64 %a, i64 %b) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: Test_get_quotient:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0:
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: movq %rdi, %rcx
|
|
|
|
; CHECK-NEXT: orq %rsi, %rcx
|
|
|
|
; CHECK-NEXT: shrq $32, %rcx
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: je .LBB0_1
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-NEXT: # %bb.2:
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: cqto
|
|
|
|
; CHECK-NEXT: idivq %rsi
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
; CHECK-NEXT: .LBB0_1:
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
|
Bias physical register immediate assignments
The machine scheduler currently biases register copies to/from
physical registers to be closer to their point of use / def to
minimize their live ranges. This change extends this to also physical
register assignments from immediate values.
This causes a reduction in reduction in overall register pressure and
minor reduction in spills and indirectly fixes an out-of-registers
assertion (PR39391).
Most test changes are from minor instruction reorderings and register
name selection changes and direct consequences of that.
Reviewers: MatzeB, qcolombet, myatsina, pcc
Subscribers: nemanjai, jvesely, nhaehnle, eraman, hiraditya,
javed.absar, arphaman, jfb, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D54218
llvm-svn: 346894
2018-11-15 05:11:53 +08:00
|
|
|
; CHECK-NEXT: xorl %edx, %edx
|
2017-01-13 03:34:15 +08:00
|
|
|
; CHECK-NEXT: divl %esi
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK-NEXT: # kill: def $eax killed $eax def $rax
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: retq
|
2013-03-05 02:13:57 +08:00
|
|
|
%result = sdiv i64 %a, %b
|
|
|
|
ret i64 %result
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @Test_get_remainder(i64 %a, i64 %b) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: Test_get_remainder:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0:
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: movq %rdi, %rcx
|
|
|
|
; CHECK-NEXT: orq %rsi, %rcx
|
|
|
|
; CHECK-NEXT: shrq $32, %rcx
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: je .LBB1_1
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-NEXT: # %bb.2:
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: cqto
|
|
|
|
; CHECK-NEXT: idivq %rsi
|
|
|
|
; CHECK-NEXT: movq %rdx, %rax
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
; CHECK-NEXT: .LBB1_1:
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
|
Bias physical register immediate assignments
The machine scheduler currently biases register copies to/from
physical registers to be closer to their point of use / def to
minimize their live ranges. This change extends this to also physical
register assignments from immediate values.
This causes a reduction in reduction in overall register pressure and
minor reduction in spills and indirectly fixes an out-of-registers
assertion (PR39391).
Most test changes are from minor instruction reorderings and register
name selection changes and direct consequences of that.
Reviewers: MatzeB, qcolombet, myatsina, pcc
Subscribers: nemanjai, jvesely, nhaehnle, eraman, hiraditya,
javed.absar, arphaman, jfb, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D54218
llvm-svn: 346894
2018-11-15 05:11:53 +08:00
|
|
|
; CHECK-NEXT: xorl %edx, %edx
|
2017-01-13 03:34:15 +08:00
|
|
|
; CHECK-NEXT: divl %esi
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: movl %edx, %eax
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: retq
|
2013-03-05 02:13:57 +08:00
|
|
|
%result = srem i64 %a, %b
|
|
|
|
ret i64 %result
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @Test_get_quotient_and_remainder(i64 %a, i64 %b) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: Test_get_quotient_and_remainder:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0:
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: movq %rdi, %rcx
|
|
|
|
; CHECK-NEXT: orq %rsi, %rcx
|
|
|
|
; CHECK-NEXT: shrq $32, %rcx
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: je .LBB2_1
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-NEXT: # %bb.2:
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: cqto
|
|
|
|
; CHECK-NEXT: idivq %rsi
|
|
|
|
; CHECK-NEXT: addq %rdx, %rax
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
; CHECK-NEXT: .LBB2_1:
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
|
Bias physical register immediate assignments
The machine scheduler currently biases register copies to/from
physical registers to be closer to their point of use / def to
minimize their live ranges. This change extends this to also physical
register assignments from immediate values.
This causes a reduction in reduction in overall register pressure and
minor reduction in spills and indirectly fixes an out-of-registers
assertion (PR39391).
Most test changes are from minor instruction reorderings and register
name selection changes and direct consequences of that.
Reviewers: MatzeB, qcolombet, myatsina, pcc
Subscribers: nemanjai, jvesely, nhaehnle, eraman, hiraditya,
javed.absar, arphaman, jfb, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D54218
llvm-svn: 346894
2018-11-15 05:11:53 +08:00
|
|
|
; CHECK-NEXT: xorl %edx, %edx
|
2017-01-13 03:34:15 +08:00
|
|
|
; CHECK-NEXT: divl %esi
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK-NEXT: # kill: def $edx killed $edx def $rdx
|
|
|
|
; CHECK-NEXT: # kill: def $eax killed $eax def $rax
|
2017-01-13 03:29:18 +08:00
|
|
|
; CHECK-NEXT: addq %rdx, %rax
|
|
|
|
; CHECK-NEXT: retq
|
2013-03-05 02:13:57 +08:00
|
|
|
%resultdiv = sdiv i64 %a, %b
|
|
|
|
%resultrem = srem i64 %a, %b
|
|
|
|
%result = add i64 %resultdiv, %resultrem
|
|
|
|
ret i64 %result
|
|
|
|
}
|
2019-10-02 05:25:36 +08:00
|
|
|
|
|
|
|
define void @PR43514(i32 %x, i32 %y) {
|
|
|
|
; CHECK-LABEL: PR43514:
|
|
|
|
; CHECK: # %bb.0:
|
|
|
|
; CHECK-NEXT: retq
|
|
|
|
%z1 = zext i32 %x to i64
|
|
|
|
%z2 = zext i32 %y to i64
|
|
|
|
%s = srem i64 %z1, %z2
|
|
|
|
ret void
|
|
|
|
}
|