2017-09-05 20:28:30 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-- -mcpu=corei7 | FileCheck %s --check-prefix=ALL --check-prefix=X64
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-- -mcpu=corei7-avx | FileCheck %s --check-prefix=ALL --check-prefix=SHLD
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-- -mcpu=core-avx2 | FileCheck %s --check-prefix=ALL --check-prefix=BMI2
|
2008-10-17 09:23:35 +08:00
|
|
|
|
|
|
|
define i64 @foo(i64 %x, i64 %y, i64 %z) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-LABEL: foo:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0: # %entry
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: movq %rdx, %rcx
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: # kill: def $cl killed $cl killed $rcx
|
|
|
|
; ALL-NEXT: rolq %cl, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: retq
|
2008-10-17 09:23:35 +08:00
|
|
|
entry:
|
|
|
|
%0 = shl i64 %x, %z
|
|
|
|
%1 = sub i64 64, %z
|
|
|
|
%2 = lshr i64 %x, %1
|
|
|
|
%3 = or i64 %2, %0
|
|
|
|
ret i64 %3
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @bar(i64 %x, i64 %y, i64 %z) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-LABEL: bar:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0: # %entry
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: movq %rdx, %rcx
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movq %rsi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: # kill: def $cl killed $cl killed $rcx
|
|
|
|
; ALL-NEXT: shldq %cl, %rdi, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: retq
|
2008-10-17 09:23:35 +08:00
|
|
|
entry:
|
|
|
|
%0 = shl i64 %y, %z
|
|
|
|
%1 = sub i64 64, %z
|
|
|
|
%2 = lshr i64 %x, %1
|
|
|
|
%3 = or i64 %2, %0
|
|
|
|
ret i64 %3
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @un(i64 %x, i64 %y, i64 %z) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-LABEL: un:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0: # %entry
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: movq %rdx, %rcx
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: # kill: def $cl killed $cl killed $rcx
|
|
|
|
; ALL-NEXT: rorq %cl, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: retq
|
2008-10-17 09:23:35 +08:00
|
|
|
entry:
|
|
|
|
%0 = lshr i64 %x, %z
|
|
|
|
%1 = sub i64 64, %z
|
|
|
|
%2 = shl i64 %x, %1
|
|
|
|
%3 = or i64 %2, %0
|
|
|
|
ret i64 %3
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @bu(i64 %x, i64 %y, i64 %z) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-LABEL: bu:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0: # %entry
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: movq %rdx, %rcx
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movq %rsi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: # kill: def $cl killed $cl killed $rcx
|
|
|
|
; ALL-NEXT: shrdq %cl, %rdi, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: retq
|
2008-10-17 09:23:35 +08:00
|
|
|
entry:
|
|
|
|
%0 = lshr i64 %y, %z
|
|
|
|
%1 = sub i64 64, %z
|
|
|
|
%2 = shl i64 %x, %1
|
|
|
|
%3 = or i64 %2, %0
|
|
|
|
ret i64 %3
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @xfoo(i64 %x, i64 %y, i64 %z) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-LABEL: xfoo:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-NEXT: rolq $7, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
2017-02-21 14:39:13 +08:00
|
|
|
; SHLD-LABEL: xfoo:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SHLD: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; SHLD-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; SHLD-NEXT: shldq $7, %rdi, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; SHLD-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; BMI2-LABEL: xfoo:
|
2017-12-05 01:18:51 +08:00
|
|
|
; BMI2: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; BMI2-NEXT: rorxq $57, %rdi, %rax
|
|
|
|
; BMI2-NEXT: retq
|
|
|
|
entry:
|
2008-10-17 09:23:35 +08:00
|
|
|
%0 = lshr i64 %x, 57
|
|
|
|
%1 = shl i64 %x, 7
|
|
|
|
%2 = or i64 %0, %1
|
|
|
|
ret i64 %2
|
|
|
|
}
|
|
|
|
|
2012-09-26 16:24:51 +08:00
|
|
|
define i64 @xfoop(i64* %p) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-LABEL: xfoop:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-NEXT: movq (%rdi), %rax
|
|
|
|
; X64-NEXT: rolq $7, %rax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
2017-02-21 14:39:13 +08:00
|
|
|
; SHLD-LABEL: xfoop:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SHLD: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; SHLD-NEXT: movq (%rdi), %rax
|
|
|
|
; SHLD-NEXT: shldq $7, %rax, %rax
|
|
|
|
; SHLD-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; BMI2-LABEL: xfoop:
|
2017-12-05 01:18:51 +08:00
|
|
|
; BMI2: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; BMI2-NEXT: rorxq $57, (%rdi), %rax
|
|
|
|
; BMI2-NEXT: retq
|
|
|
|
entry:
|
2015-02-28 05:17:42 +08:00
|
|
|
%x = load i64, i64* %p
|
2012-09-26 16:24:51 +08:00
|
|
|
%a = lshr i64 %x, 57
|
|
|
|
%b = shl i64 %x, 7
|
|
|
|
%c = or i64 %a, %b
|
|
|
|
ret i64 %c
|
|
|
|
}
|
|
|
|
|
2008-10-17 09:23:35 +08:00
|
|
|
define i64 @xbar(i64 %x, i64 %y, i64 %z) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-LABEL: xbar:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: shrdq $57, %rsi, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: retq
|
2008-10-17 09:23:35 +08:00
|
|
|
entry:
|
|
|
|
%0 = shl i64 %y, 7
|
|
|
|
%1 = lshr i64 %x, 57
|
|
|
|
%2 = or i64 %0, %1
|
|
|
|
ret i64 %2
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @xun(i64 %x, i64 %y, i64 %z) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-LABEL: xun:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-NEXT: rolq $57, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
2017-02-21 14:39:13 +08:00
|
|
|
; SHLD-LABEL: xun:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SHLD: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; SHLD-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; SHLD-NEXT: shldq $57, %rdi, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; SHLD-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; BMI2-LABEL: xun:
|
2017-12-05 01:18:51 +08:00
|
|
|
; BMI2: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; BMI2-NEXT: rorxq $7, %rdi, %rax
|
|
|
|
; BMI2-NEXT: retq
|
|
|
|
entry:
|
2008-10-17 09:23:35 +08:00
|
|
|
%0 = lshr i64 %x, 7
|
|
|
|
%1 = shl i64 %x, 57
|
|
|
|
%2 = or i64 %0, %1
|
|
|
|
ret i64 %2
|
|
|
|
}
|
|
|
|
|
2012-09-26 16:24:51 +08:00
|
|
|
define i64 @xunp(i64* %p) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-LABEL: xunp:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; X64-NEXT: movq (%rdi), %rax
|
|
|
|
; X64-NEXT: rolq $57, %rax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
;
|
2017-02-21 14:39:13 +08:00
|
|
|
; SHLD-LABEL: xunp:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SHLD: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; SHLD-NEXT: movq (%rdi), %rax
|
|
|
|
; SHLD-NEXT: shldq $57, %rax, %rax
|
|
|
|
; SHLD-NEXT: retq
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; BMI2-LABEL: xunp:
|
2017-12-05 01:18:51 +08:00
|
|
|
; BMI2: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; BMI2-NEXT: rorxq $7, (%rdi), %rax
|
|
|
|
; BMI2-NEXT: retq
|
|
|
|
entry:
|
2015-02-28 05:17:42 +08:00
|
|
|
%x = load i64, i64* %p
|
2012-09-26 16:24:51 +08:00
|
|
|
%a = lshr i64 %x, 7
|
|
|
|
%b = shl i64 %x, 57
|
|
|
|
%c = or i64 %a, %b
|
|
|
|
ret i64 %c
|
|
|
|
}
|
|
|
|
|
2008-10-17 09:23:35 +08:00
|
|
|
define i64 @xbu(i64 %x, i64 %y, i64 %z) nounwind readnone {
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-LABEL: xbu:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: # %bb.0: # %entry
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; ALL-NEXT: shldq $57, %rsi, %rax
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: retq
|
2008-10-17 09:23:35 +08:00
|
|
|
entry:
|
|
|
|
%0 = lshr i64 %y, 7
|
|
|
|
%1 = shl i64 %x, 57
|
|
|
|
%2 = or i64 %0, %1
|
|
|
|
ret i64 %2
|
|
|
|
}
|