2018-07-17 06:59:31 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=i686-- -mattr=sse2 | FileCheck %s --check-prefixes=ANY,X32-SSE2
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-- -mattr=avx2 | FileCheck %s --check-prefixes=ANY,X64-AVX2
|
|
|
|
|
|
|
|
declare i8 @llvm.fshl.i8(i8, i8, i8)
|
|
|
|
declare i16 @llvm.fshl.i16(i16, i16, i16)
|
|
|
|
declare i32 @llvm.fshl.i32(i32, i32, i32)
|
|
|
|
declare i64 @llvm.fshl.i64(i64, i64, i64)
|
|
|
|
declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
|
|
|
|
|
|
|
|
declare i8 @llvm.fshr.i8(i8, i8, i8)
|
|
|
|
declare i16 @llvm.fshr.i16(i16, i16, i16)
|
|
|
|
declare i32 @llvm.fshr.i32(i32, i32, i32)
|
|
|
|
declare i64 @llvm.fshr.i64(i64, i64, i64)
|
|
|
|
declare <4 x i32> @llvm.fshr.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
|
|
|
|
|
2018-12-05 19:12:12 +08:00
|
|
|
; General case - all operands can be variables
|
2018-07-17 06:59:31 +08:00
|
|
|
|
|
|
|
define i32 @fshl_i32(i32 %x, i32 %y, i32 %z) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32:
|
|
|
|
; X32-SSE2: # %bb.0:
|
2018-12-05 19:12:12 +08:00
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edx
|
2018-12-05 19:12:12 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: shldl %cl, %edx, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edx, %ecx
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
2018-12-05 19:12:12 +08:00
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: shldl %cl, %esi, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 %z)
|
|
|
|
ret i32 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; Verify that weird types are minimally supported.
|
|
|
|
declare i37 @llvm.fshl.i37(i37, i37, i37)
|
|
|
|
define i37 @fshl_i37(i37 %x, i37 %y, i37 %z) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i37:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: pushl %ebp
|
|
|
|
; X32-SSE2-NEXT: pushl %ebx
|
|
|
|
; X32-SSE2-NEXT: pushl %edi
|
|
|
|
; X32-SSE2-NEXT: pushl %esi
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: pushl %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edi
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %esi
|
|
|
|
; X32-SSE2-NEXT: andl $31, %esi
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: andl $31, %eax
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ebp
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: pushl $0
|
|
|
|
; X32-SSE2-NEXT: pushl $37
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: pushl %eax
|
|
|
|
; X32-SSE2-NEXT: pushl {{[0-9]+}}(%esp)
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: calll __umoddi3
|
|
|
|
; X32-SSE2-NEXT: addl $16, %esp
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: movl %eax, %ebx
|
|
|
|
; X32-SSE2-NEXT: movl %edx, (%esp) # 4-byte Spill
|
|
|
|
; X32-SSE2-NEXT: movl %ebp, %edx
|
|
|
|
; X32-SSE2-NEXT: movl %ebx, %ecx
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: shll %cl, %ebp
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shldl %cl, %edx, %eax
|
|
|
|
; X32-SSE2-NEXT: xorl %ecx, %ecx
|
|
|
|
; X32-SSE2-NEXT: testb $32, %bl
|
|
|
|
; X32-SSE2-NEXT: cmovnel %ebp, %eax
|
|
|
|
; X32-SSE2-NEXT: cmovnel %ecx, %ebp
|
|
|
|
; X32-SSE2-NEXT: xorl %edx, %edx
|
2018-12-09 00:07:38 +08:00
|
|
|
; X32-SSE2-NEXT: movb $37, %cl
|
|
|
|
; X32-SSE2-NEXT: subb %bl, %cl
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: shrdl %cl, %esi, %edi
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: shrl %cl, %esi
|
|
|
|
; X32-SSE2-NEXT: testb $32, %cl
|
|
|
|
; X32-SSE2-NEXT: cmovnel %esi, %edi
|
|
|
|
; X32-SSE2-NEXT: cmovnel %edx, %esi
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: orl %eax, %esi
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: orl %ebp, %edi
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: orl %ebx, (%esp) # 4-byte Folded Spill
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: cmovel {{[0-9]+}}(%esp), %edi
|
|
|
|
; X32-SSE2-NEXT: cmovel {{[0-9]+}}(%esp), %esi
|
|
|
|
; X32-SSE2-NEXT: movl %edi, %eax
|
|
|
|
; X32-SSE2-NEXT: movl %esi, %edx
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: addl $4, %esp
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: popl %esi
|
|
|
|
; X32-SSE2-NEXT: popl %edi
|
|
|
|
; X32-SSE2-NEXT: popl %ebx
|
|
|
|
; X32-SSE2-NEXT: popl %ebp
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i37:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: movq %rdx, %r8
|
|
|
|
; X64-AVX2-NEXT: movabsq $137438953471, %rax # imm = 0x1FFFFFFFFF
|
|
|
|
; X64-AVX2-NEXT: andq %rax, %rsi
|
|
|
|
; X64-AVX2-NEXT: andq %rax, %r8
|
|
|
|
; X64-AVX2-NEXT: movabsq $-2492803253203993461, %rcx # imm = 0xDD67C8A60DD67C8B
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: movq %r8, %rax
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: mulq %rcx
|
2018-07-25 07:44:17 +08:00
|
|
|
; X64-AVX2-NEXT: shrq $5, %rdx
|
|
|
|
; X64-AVX2-NEXT: leaq (%rdx,%rdx,8), %rax
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: leaq (%rdx,%rax,4), %rax
|
|
|
|
; X64-AVX2-NEXT: subq %rax, %r8
|
|
|
|
; X64-AVX2-NEXT: movq %rdi, %rax
|
|
|
|
; X64-AVX2-NEXT: movl %r8d, %ecx
|
|
|
|
; X64-AVX2-NEXT: shlq %cl, %rax
|
|
|
|
; X64-AVX2-NEXT: movl $37, %ecx
|
|
|
|
; X64-AVX2-NEXT: subl %r8d, %ecx
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: shrq %cl, %rsi
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: orq %rax, %rsi
|
|
|
|
; X64-AVX2-NEXT: testq %r8, %r8
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: cmoveq %rdi, %rsi
|
|
|
|
; X64-AVX2-NEXT: movq %rsi, %rax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i37 @llvm.fshl.i37(i37 %x, i37 %y, i37 %z)
|
|
|
|
ret i37 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; extract(concat(0b1110000, 0b1111111) << 2) = 0b1000011
|
|
|
|
|
|
|
|
declare i7 @llvm.fshl.i7(i7, i7, i7)
|
|
|
|
define i7 @fshl_i7_const_fold() {
|
|
|
|
; ANY-LABEL: fshl_i7_const_fold:
|
|
|
|
; ANY: # %bb.0:
|
|
|
|
; ANY-NEXT: movb $67, %al
|
|
|
|
; ANY-NEXT: ret{{[l|q]}}
|
|
|
|
%f = call i7 @llvm.fshl.i7(i7 112, i7 127, i7 2)
|
|
|
|
ret i7 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; With constant shift amount, this is 'shld' with constant operand.
|
|
|
|
|
|
|
|
define i32 @fshl_i32_const_shift(i32 %x, i32 %y) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_const_shift:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shldl $9, %ecx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_const_shift:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-AVX2-NEXT: shldl $9, %esi, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 9)
|
|
|
|
ret i32 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check modulo math on shift amount.
|
|
|
|
|
|
|
|
define i32 @fshl_i32_const_overshift(i32 %x, i32 %y) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_const_overshift:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shldl $9, %ecx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_const_overshift:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-AVX2-NEXT: shldl $9, %esi, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 41)
|
|
|
|
ret i32 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; 64-bit should also work.
|
|
|
|
|
|
|
|
define i64 @fshl_i64_const_overshift(i64 %x, i64 %y) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i64_const_overshift:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edx
|
|
|
|
; X32-SSE2-NEXT: shldl $9, %ecx, %edx
|
|
|
|
; X32-SSE2-NEXT: shrdl $23, %ecx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i64_const_overshift:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-AVX2-NEXT: shldq $41, %rsi, %rax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i64 @llvm.fshl.i64(i64 %x, i64 %y, i64 105)
|
|
|
|
ret i64 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; This should work without any node-specific logic.
|
|
|
|
|
|
|
|
define i8 @fshl_i8_const_fold() nounwind {
|
|
|
|
; ANY-LABEL: fshl_i8_const_fold:
|
|
|
|
; ANY: # %bb.0:
|
|
|
|
; ANY-NEXT: movb $-128, %al
|
|
|
|
; ANY-NEXT: ret{{[l|q]}}
|
|
|
|
%f = call i8 @llvm.fshl.i8(i8 255, i8 0, i8 7)
|
|
|
|
ret i8 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; Repeat everything for funnel shift right.
|
|
|
|
|
2018-12-05 19:12:12 +08:00
|
|
|
; General case - all operands can be variables
|
2018-07-17 06:59:31 +08:00
|
|
|
|
|
|
|
define i32 @fshr_i32(i32 %x, i32 %y, i32 %z) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32:
|
|
|
|
; X32-SSE2: # %bb.0:
|
2018-12-05 19:12:12 +08:00
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edx
|
2018-12-05 19:12:12 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: shrdl %cl, %edx, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edx, %ecx
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-AVX2-NEXT: movl %esi, %eax
|
2018-12-05 19:12:12 +08:00
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: shrdl %cl, %edi, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 %z)
|
|
|
|
ret i32 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; Verify that weird types are minimally supported.
|
|
|
|
declare i37 @llvm.fshr.i37(i37, i37, i37)
|
|
|
|
define i37 @fshr_i37(i37 %x, i37 %y, i37 %z) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i37:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: pushl %ebp
|
|
|
|
; X32-SSE2-NEXT: pushl %ebx
|
|
|
|
; X32-SSE2-NEXT: pushl %edi
|
|
|
|
; X32-SSE2-NEXT: pushl %esi
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %esi
|
|
|
|
; X32-SSE2-NEXT: andl $31, %esi
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: andl $31, %eax
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ebp
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edi
|
|
|
|
; X32-SSE2-NEXT: pushl $0
|
|
|
|
; X32-SSE2-NEXT: pushl $37
|
|
|
|
; X32-SSE2-NEXT: pushl %eax
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: pushl {{[0-9]+}}(%esp)
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: calll __umoddi3
|
|
|
|
; X32-SSE2-NEXT: addl $16, %esp
|
|
|
|
; X32-SSE2-NEXT: movl %eax, %ebx
|
2018-12-09 00:07:38 +08:00
|
|
|
; X32-SSE2-NEXT: movb $37, %cl
|
|
|
|
; X32-SSE2-NEXT: subb %bl, %cl
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: movl %ebp, %eax
|
|
|
|
; X32-SSE2-NEXT: shll %cl, %ebp
|
|
|
|
; X32-SSE2-NEXT: shldl %cl, %eax, %edi
|
|
|
|
; X32-SSE2-NEXT: xorl %eax, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: testb $32, %cl
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: cmovnel %ebp, %edi
|
|
|
|
; X32-SSE2-NEXT: cmovnel %eax, %ebp
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: movl %ebx, %ecx
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: shrdl %cl, %esi, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: shrl %cl, %esi
|
|
|
|
; X32-SSE2-NEXT: testb $32, %bl
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: cmovnel %esi, %eax
|
|
|
|
; X32-SSE2-NEXT: movl $0, %ecx
|
|
|
|
; X32-SSE2-NEXT: cmovnel %ecx, %esi
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: orl %edi, %esi
|
2018-08-02 01:17:08 +08:00
|
|
|
; X32-SSE2-NEXT: orl %ebp, %eax
|
|
|
|
; X32-SSE2-NEXT: orl %ebx, %edx
|
|
|
|
; X32-SSE2-NEXT: cmovel {{[0-9]+}}(%esp), %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: cmovel {{[0-9]+}}(%esp), %esi
|
|
|
|
; X32-SSE2-NEXT: movl %esi, %edx
|
|
|
|
; X32-SSE2-NEXT: popl %esi
|
|
|
|
; X32-SSE2-NEXT: popl %edi
|
|
|
|
; X32-SSE2-NEXT: popl %ebx
|
|
|
|
; X32-SSE2-NEXT: popl %ebp
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i37:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: movq %rdx, %r8
|
|
|
|
; X64-AVX2-NEXT: movabsq $137438953471, %rax # imm = 0x1FFFFFFFFF
|
|
|
|
; X64-AVX2-NEXT: movq %rsi, %r9
|
|
|
|
; X64-AVX2-NEXT: andq %rax, %r9
|
|
|
|
; X64-AVX2-NEXT: andq %rax, %r8
|
|
|
|
; X64-AVX2-NEXT: movabsq $-2492803253203993461, %rcx # imm = 0xDD67C8A60DD67C8B
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: movq %r8, %rax
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: mulq %rcx
|
2018-07-25 07:44:17 +08:00
|
|
|
; X64-AVX2-NEXT: shrq $5, %rdx
|
|
|
|
; X64-AVX2-NEXT: leaq (%rdx,%rdx,8), %rax
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: leaq (%rdx,%rax,4), %rax
|
|
|
|
; X64-AVX2-NEXT: subq %rax, %r8
|
|
|
|
; X64-AVX2-NEXT: movl %r8d, %ecx
|
|
|
|
; X64-AVX2-NEXT: shrq %cl, %r9
|
|
|
|
; X64-AVX2-NEXT: movl $37, %ecx
|
|
|
|
; X64-AVX2-NEXT: subl %r8d, %ecx
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: shlq %cl, %rdi
|
2018-08-02 01:17:08 +08:00
|
|
|
; X64-AVX2-NEXT: orq %r9, %rdi
|
|
|
|
; X64-AVX2-NEXT: testq %r8, %r8
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: cmoveq %rsi, %rdi
|
|
|
|
; X64-AVX2-NEXT: movq %rdi, %rax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i37 @llvm.fshr.i37(i37 %x, i37 %y, i37 %z)
|
|
|
|
ret i37 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; extract(concat(0b1110000, 0b1111111) >> 2) = 0b0011111
|
|
|
|
|
|
|
|
declare i7 @llvm.fshr.i7(i7, i7, i7)
|
|
|
|
define i7 @fshr_i7_const_fold() nounwind {
|
|
|
|
; ANY-LABEL: fshr_i7_const_fold:
|
|
|
|
; ANY: # %bb.0:
|
|
|
|
; ANY-NEXT: movb $31, %al
|
|
|
|
; ANY-NEXT: ret{{[l|q]}}
|
|
|
|
%f = call i7 @llvm.fshr.i7(i7 112, i7 127, i7 2)
|
|
|
|
ret i7 %f
|
|
|
|
}
|
|
|
|
|
2019-02-09 00:51:16 +08:00
|
|
|
; demanded bits tests
|
|
|
|
|
|
|
|
define i32 @fshl_i32_demandedbits(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_demandedbits:
|
|
|
|
; X32-SSE2: # %bb.0:
|
2019-02-09 01:19:01 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2019-02-09 00:51:16 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2019-02-09 01:19:01 +08:00
|
|
|
; X32-SSE2-NEXT: shldl $9, %ecx, %eax
|
2019-02-09 00:51:16 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_demandedbits:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2019-02-09 01:19:01 +08:00
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: shldl $9, %esi, %eax
|
2019-02-09 00:51:16 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%x = or i32 %a0, 2147483648
|
|
|
|
%y = or i32 %a1, 1
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshr_i32_demandedbits(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_demandedbits:
|
|
|
|
; X32-SSE2: # %bb.0:
|
2019-02-09 01:19:01 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
2019-02-09 00:51:16 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shrdl $9, %ecx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_demandedbits:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2019-02-09 01:19:01 +08:00
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: shldl $23, %esi, %eax
|
2019-02-09 00:51:16 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%x = or i32 %a0, 2147483648
|
|
|
|
%y = or i32 %a1, 1
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 06:21:09 +08:00
|
|
|
; undef handling
|
|
|
|
|
|
|
|
define i32 @fshl_i32_undef0(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_undef0:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shldl %cl, %eax, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_undef0:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shldl %cl, %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 undef, i32 %a0, i32 %a1)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 23:46:32 +08:00
|
|
|
define i32 @fshl_i32_undef0_msk(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_undef0_msk:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: andl $7, %ecx
|
|
|
|
; X32-SSE2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X32-SSE2-NEXT: shldl %cl, %eax, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_undef0_msk:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: andl $7, %ecx
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shldl %cl, %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%m = and i32 %a1, 7
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 undef, i32 %a0, i32 %m)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 06:21:09 +08:00
|
|
|
define i32 @fshl_i32_undef0_cst(i32 %a0) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_undef0_cst:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: shrl $23, %eax
|
2019-02-10 06:21:09 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_undef0_cst:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: shrl $23, %eax
|
2019-02-10 06:21:09 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 undef, i32 %a0, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshl_i32_undef1(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_undef1:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shldl %cl, %eax, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_undef1:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shldl %cl, %eax, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 %a0, i32 undef, i32 %a1)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 23:46:32 +08:00
|
|
|
define i32 @fshl_i32_undef1_msk(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_undef1_msk:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: andb $7, %cl
|
|
|
|
; X32-SSE2-NEXT: shll %cl, %eax
|
2019-02-10 23:46:32 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_undef1_msk:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: andb $7, %cl
|
2019-02-10 23:46:32 +08:00
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: shll %cl, %eax
|
2019-02-10 23:46:32 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%m = and i32 %a1, 7
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 %a0, i32 undef, i32 %m)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 06:21:09 +08:00
|
|
|
define i32 @fshl_i32_undef1_cst(i32 %a0) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_undef1_cst:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: shll $9, %eax
|
2019-02-10 06:21:09 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_undef1_cst:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: shll $9, %eax
|
2019-02-10 06:21:09 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 %a0, i32 undef, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 22:54:57 +08:00
|
|
|
define i32 @fshl_i32_undef2(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_undef2:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shldl %cl, %ecx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_undef2:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: shldl %cl, %esi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 %a0, i32 %a1, i32 undef)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 06:21:09 +08:00
|
|
|
define i32 @fshr_i32_undef0(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_undef0:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shrdl %cl, %eax, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_undef0:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shrdl %cl, %eax, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 undef, i32 %a0, i32 %a1)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 23:46:32 +08:00
|
|
|
define i32 @fshr_i32_undef0_msk(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_undef0_msk:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: andb $7, %cl
|
|
|
|
; X32-SSE2-NEXT: shrl %cl, %eax
|
2019-02-10 23:46:32 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_undef0_msk:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: andb $7, %cl
|
2019-02-10 23:46:32 +08:00
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: shrl %cl, %eax
|
2019-02-10 23:46:32 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%m = and i32 %a1, 7
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 undef, i32 %a0, i32 %m)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 06:21:09 +08:00
|
|
|
define i32 @fshr_i32_undef0_cst(i32 %a0) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_undef0_cst:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: shrl $9, %eax
|
2019-02-10 06:21:09 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_undef0_cst:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: shrl $9, %eax
|
2019-02-10 06:21:09 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 undef, i32 %a0, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshr_i32_undef1(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_undef1:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shrdl %cl, %eax, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_undef1:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shrdl %cl, %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 %a0, i32 undef, i32 %a1)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 23:46:32 +08:00
|
|
|
define i32 @fshr_i32_undef1_msk(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_undef1_msk:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: andl $7, %ecx
|
|
|
|
; X32-SSE2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X32-SSE2-NEXT: shrdl %cl, %eax, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_undef1_msk:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: andl $7, %ecx
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shrdl %cl, %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%m = and i32 %a1, 7
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 %a0, i32 undef, i32 %m)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 06:21:09 +08:00
|
|
|
define i32 @fshr_i32_undef1_cst(i32 %a0) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_undef1_cst:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: shll $23, %eax
|
2019-02-10 06:21:09 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_undef1_cst:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: shll $23, %eax
|
2019-02-10 06:21:09 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 %a0, i32 undef, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2019-02-10 22:54:57 +08:00
|
|
|
define i32 @fshr_i32_undef2(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_undef2:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shrdl %cl, %ecx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_undef2:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %eax
|
|
|
|
; X64-AVX2-NEXT: shrdl %cl, %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 %a0, i32 %a1, i32 undef)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; shift zero args
|
|
|
|
|
|
|
|
define i32 @fshl_i32_zero0(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_zero0:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edx
|
|
|
|
; X32-SSE2-NEXT: xorl %eax, %eax
|
|
|
|
; X32-SSE2-NEXT: shldl %cl, %edx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_zero0:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: xorl %eax, %eax
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shldl %cl, %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 0, i32 %a0, i32 %a1)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshl_i32_zero0_cst(i32 %a0) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_zero0_cst:
|
|
|
|
; X32-SSE2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shrl $23, %eax
|
2019-02-10 22:54:57 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_zero0_cst:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: shrl $23, %eax
|
2019-02-10 22:54:57 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 0, i32 %a0, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshl_i32_zero1(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_zero1:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: xorl %edx, %edx
|
|
|
|
; X32-SSE2-NEXT: shldl %cl, %edx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_zero1:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: xorl %edx, %edx
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shldl %cl, %edx, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 %a0, i32 0, i32 %a1)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshl_i32_zero1_cst(i32 %a0) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_zero1_cst:
|
|
|
|
; X32-SSE2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shll $9, %eax
|
2019-02-10 22:54:57 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_zero1_cst:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: shll $9, %eax
|
2019-02-10 22:54:57 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 %a0, i32 0, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshr_i32_zero0(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_zero0:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: xorl %edx, %edx
|
|
|
|
; X32-SSE2-NEXT: shrdl %cl, %edx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_zero0:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: xorl %edx, %edx
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shrdl %cl, %edx, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 0, i32 %a0, i32 %a1)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshr_i32_zero0_cst(i32 %a0) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_zero0_cst:
|
|
|
|
; X32-SSE2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shrl $9, %eax
|
2019-02-10 22:54:57 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_zero0_cst:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: shrl $9, %eax
|
2019-02-10 22:54:57 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 0, i32 %a0, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshr_i32_zero1(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_zero1:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edx
|
|
|
|
; X32-SSE2-NEXT: xorl %eax, %eax
|
|
|
|
; X32-SSE2-NEXT: shrdl %cl, %edx, %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_zero1:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %ecx
|
|
|
|
; X64-AVX2-NEXT: xorl %eax, %eax
|
|
|
|
; X64-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
|
|
|
|
; X64-AVX2-NEXT: shrdl %cl, %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 %a0, i32 0, i32 %a1)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshr_i32_zero1_cst(i32 %a0) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_zero1_cst:
|
|
|
|
; X32-SSE2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: shll $23, %eax
|
2019-02-10 22:54:57 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_zero1_cst:
|
|
|
|
; X64-AVX2: # %bb.0:
|
2019-02-11 01:04:00 +08:00
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: shll $23, %eax
|
2019-02-10 22:54:57 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 %a0, i32 0, i32 9)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
; shift by zero
|
|
|
|
|
|
|
|
define i32 @fshl_i32_zero2(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_zero2:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_zero2:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshl.i32(i32 %a0, i32 %a1, i32 0)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshr_i32_zero2(i32 %a0, i32 %a1) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_zero2:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_zero2:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%res = call i32 @llvm.fshr.i32(i32 %a0, i32 %a1, i32 0)
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2018-07-17 06:59:31 +08:00
|
|
|
; With constant shift amount, this is 'shrd' or 'shld'.
|
|
|
|
|
|
|
|
define i32 @fshr_i32_const_shift(i32 %x, i32 %y) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_const_shift:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2018-12-05 19:12:12 +08:00
|
|
|
; X32-SSE2-NEXT: shrdl $9, %ecx, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_const_shift:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-AVX2-NEXT: shldl $23, %esi, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 9)
|
|
|
|
ret i32 %f
|
|
|
|
}
|
|
|
|
|
2018-12-05 19:12:12 +08:00
|
|
|
; Check modulo math on shift amount. 41-32=9, but right-shift may became left, so 32-9=23.
|
2018-07-17 06:59:31 +08:00
|
|
|
|
|
|
|
define i32 @fshr_i32_const_overshift(i32 %x, i32 %y) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_const_overshift:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
2018-12-05 19:12:12 +08:00
|
|
|
; X32-SSE2-NEXT: shrdl $9, %ecx, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_const_overshift:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-AVX2-NEXT: shldl $23, %esi, %eax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 41)
|
|
|
|
ret i32 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; 64-bit should also work. 105-64 = 41, but right-shift became left, so 64-41=23.
|
|
|
|
|
|
|
|
define i64 @fshr_i64_const_overshift(i64 %x, i64 %y) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i64_const_overshift:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %edx
|
|
|
|
; X32-SSE2-NEXT: shrdl $9, %ecx, %eax
|
|
|
|
; X32-SSE2-NEXT: shldl $23, %ecx, %edx
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i64_const_overshift:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movq %rdi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; X64-AVX2-NEXT: shldq $23, %rsi, %rax
|
2018-07-17 06:59:31 +08:00
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i64 @llvm.fshr.i64(i64 %x, i64 %y, i64 105)
|
|
|
|
ret i64 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
; This should work without any node-specific logic.
|
|
|
|
|
|
|
|
define i8 @fshr_i8_const_fold() nounwind {
|
|
|
|
; ANY-LABEL: fshr_i8_const_fold:
|
|
|
|
; ANY: # %bb.0:
|
|
|
|
; ANY-NEXT: movb $-2, %al
|
|
|
|
; ANY-NEXT: ret{{[l|q]}}
|
|
|
|
%f = call i8 @llvm.fshr.i8(i8 255, i8 0, i8 7)
|
|
|
|
ret i8 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshl_i32_shift_by_bitwidth(i32 %x, i32 %y) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshl_i32_shift_by_bitwidth:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshl_i32_shift_by_bitwidth:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %edi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 32)
|
|
|
|
ret i32 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @fshr_i32_shift_by_bitwidth(i32 %x, i32 %y) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_i32_shift_by_bitwidth:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_i32_shift_by_bitwidth:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: movl %esi, %eax
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call i32 @llvm.fshr.i32(i32 %x, i32 %y, i32 32)
|
|
|
|
ret i32 %f
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i32> @fshl_v4i32_shift_by_bitwidth(<4 x i32> %x, <4 x i32> %y) nounwind {
|
|
|
|
; ANY-LABEL: fshl_v4i32_shift_by_bitwidth:
|
|
|
|
; ANY: # %bb.0:
|
|
|
|
; ANY-NEXT: ret{{[l|q]}}
|
|
|
|
%f = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %x, <4 x i32> %y, <4 x i32> <i32 32, i32 32, i32 32, i32 32>)
|
|
|
|
ret <4 x i32> %f
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i32> @fshr_v4i32_shift_by_bitwidth(<4 x i32> %x, <4 x i32> %y) nounwind {
|
|
|
|
; X32-SSE2-LABEL: fshr_v4i32_shift_by_bitwidth:
|
|
|
|
; X32-SSE2: # %bb.0:
|
|
|
|
; X32-SSE2-NEXT: movaps %xmm1, %xmm0
|
|
|
|
; X32-SSE2-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-AVX2-LABEL: fshr_v4i32_shift_by_bitwidth:
|
|
|
|
; X64-AVX2: # %bb.0:
|
|
|
|
; X64-AVX2-NEXT: vmovaps %xmm1, %xmm0
|
|
|
|
; X64-AVX2-NEXT: retq
|
|
|
|
%f = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %x, <4 x i32> %y, <4 x i32> <i32 32, i32 32, i32 32, i32 32>)
|
|
|
|
ret <4 x i32> %f
|
|
|
|
}
|
|
|
|
|