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
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movl %edx, %ecx
|
|
|
|
; ALL-NEXT: rolq %cl, %rdi
|
|
|
|
; ALL-NEXT: movq %rdi, %rax
|
|
|
|
; 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
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movl %edx, %ecx
|
|
|
|
; ALL-NEXT: shldq %cl, %rdi, %rsi
|
|
|
|
; ALL-NEXT: movq %rsi, %rax
|
|
|
|
; 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
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movl %edx, %ecx
|
|
|
|
; ALL-NEXT: rorq %cl, %rdi
|
|
|
|
; ALL-NEXT: movq %rdi, %rax
|
|
|
|
; 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
|
2017-09-05 20:28:30 +08:00
|
|
|
; ALL-NEXT: movl %edx, %ecx
|
|
|
|
; ALL-NEXT: shrdq %cl, %rdi, %rsi
|
|
|
|
; ALL-NEXT: movq %rsi, %rax
|
|
|
|
; 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: rolq $7, %rdi
|
|
|
|
; X64-NEXT: movq %rdi, %rax
|
|
|
|
; 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: shldq $7, %rdi, %rdi
|
|
|
|
; SHLD-NEXT: movq %rdi, %rax
|
|
|
|
; 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: shrdq $57, %rsi, %rdi
|
|
|
|
; ALL-NEXT: movq %rdi, %rax
|
|
|
|
; 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: rolq $57, %rdi
|
|
|
|
; X64-NEXT: movq %rdi, %rax
|
|
|
|
; 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: shldq $57, %rdi, %rdi
|
|
|
|
; SHLD-NEXT: movq %rdi, %rax
|
|
|
|
; 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: shldq $57, %rsi, %rdi
|
|
|
|
; ALL-NEXT: movq %rdi, %rax
|
|
|
|
; 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
|
|
|
|
}
|