2017-08-12 06:05:33 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X32
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
|
2008-10-17 09:23:35 +08:00
|
|
|
|
2017-08-12 06:05:33 +08:00
|
|
|
define i16 @foo(i16 %x, i16 %y, i16 %z) nounwind {
|
|
|
|
; X32-LABEL: foo:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: rolw %cl, %ax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: foo:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X64-NEXT: movl %edx, %ecx
|
|
|
|
; X64-NEXT: shldw %cl, %di, %di
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%t0 = shl i16 %x, %z
|
|
|
|
%t1 = sub i16 16, %z
|
|
|
|
%t2 = lshr i16 %x, %t1
|
|
|
|
%t3 = or i16 %t2, %t0
|
|
|
|
ret i16 %t3
|
2008-10-17 09:23:35 +08:00
|
|
|
}
|
|
|
|
|
2017-08-12 06:05:33 +08:00
|
|
|
define i16 @bar(i16 %x, i16 %y, i16 %z) nounwind {
|
|
|
|
; X32-LABEL: bar:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %edx
|
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: shldw %cl, %dx, %ax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: bar:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X64-NEXT: movl %edx, %ecx
|
|
|
|
; X64-NEXT: shldw %cl, %di, %si
|
|
|
|
; X64-NEXT: movl %esi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%t0 = shl i16 %y, %z
|
|
|
|
%t1 = sub i16 16, %z
|
|
|
|
%t2 = lshr i16 %x, %t1
|
|
|
|
%t3 = or i16 %t2, %t0
|
|
|
|
ret i16 %t3
|
2008-10-17 09:23:35 +08:00
|
|
|
}
|
|
|
|
|
2017-08-12 06:05:33 +08:00
|
|
|
define i16 @un(i16 %x, i16 %y, i16 %z) nounwind {
|
|
|
|
; X32-LABEL: un:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: rorw %cl, %ax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: un:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X64-NEXT: movl %edx, %ecx
|
|
|
|
; X64-NEXT: shrdw %cl, %di, %di
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%t0 = lshr i16 %x, %z
|
|
|
|
%t1 = sub i16 16, %z
|
|
|
|
%t2 = shl i16 %x, %t1
|
|
|
|
%t3 = or i16 %t2, %t0
|
|
|
|
ret i16 %t3
|
2008-10-17 09:23:35 +08:00
|
|
|
}
|
|
|
|
|
2017-08-12 06:05:33 +08:00
|
|
|
define i16 @bu(i16 %x, i16 %y, i16 %z) nounwind {
|
|
|
|
; X32-LABEL: bu:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
|
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %edx
|
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: shrdw %cl, %dx, %ax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: bu:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X64-NEXT: movl %edx, %ecx
|
|
|
|
; X64-NEXT: shrdw %cl, %di, %si
|
|
|
|
; X64-NEXT: movl %esi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%t0 = lshr i16 %y, %z
|
|
|
|
%t1 = sub i16 16, %z
|
|
|
|
%t2 = shl i16 %x, %t1
|
|
|
|
%t3 = or i16 %t2, %t0
|
|
|
|
ret i16 %t3
|
2008-10-17 09:23:35 +08:00
|
|
|
}
|
|
|
|
|
2017-08-12 06:05:33 +08:00
|
|
|
define i16 @xfoo(i16 %x, i16 %y, i16 %z) nounwind {
|
|
|
|
; X32-LABEL: xfoo:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: rolw $5, %ax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: xfoo:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X64-NEXT: rolw $5, %di
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%t0 = lshr i16 %x, 11
|
|
|
|
%t1 = shl i16 %x, 5
|
|
|
|
%t2 = or i16 %t0, %t1
|
|
|
|
ret i16 %t2
|
2008-10-17 09:23:35 +08:00
|
|
|
}
|
|
|
|
|
2017-08-12 06:05:33 +08:00
|
|
|
define i16 @xbar(i16 %x, i16 %y, i16 %z) nounwind {
|
|
|
|
; X32-LABEL: xbar:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: shldw $5, %cx, %ax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: xbar:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X64-NEXT: shldw $5, %di, %si
|
|
|
|
; X64-NEXT: movl %esi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%t0 = shl i16 %y, 5
|
|
|
|
%t1 = lshr i16 %x, 11
|
|
|
|
%t2 = or i16 %t0, %t1
|
|
|
|
ret i16 %t2
|
2008-10-17 09:23:35 +08:00
|
|
|
}
|
|
|
|
|
2017-08-12 06:05:33 +08:00
|
|
|
define i16 @xun(i16 %x, i16 %y, i16 %z) nounwind {
|
|
|
|
; X32-LABEL: xun:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: rolw $11, %ax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: xun:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X64-NEXT: rolw $11, %di
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%t0 = lshr i16 %x, 5
|
|
|
|
%t1 = shl i16 %x, 11
|
|
|
|
%t2 = or i16 %t0, %t1
|
|
|
|
ret i16 %t2
|
2008-10-17 09:23:35 +08:00
|
|
|
}
|
|
|
|
|
2017-08-12 06:05:33 +08:00
|
|
|
define i16 @xbu(i16 %x, i16 %y, i16 %z) nounwind {
|
|
|
|
; X32-LABEL: xbu:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X32: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
|
|
|
|
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
|
|
|
|
; X32-NEXT: shldw $11, %cx, %ax
|
|
|
|
; X32-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: xbu:
|
2017-12-05 01:18:51 +08:00
|
|
|
; X64: # %bb.0:
|
2017-08-12 06:05:33 +08:00
|
|
|
; X64-NEXT: shldw $11, %si, %di
|
|
|
|
; X64-NEXT: movl %edi, %eax
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%t0 = lshr i16 %y, 5
|
|
|
|
%t1 = shl i16 %x, 11
|
|
|
|
%t2 = or i16 %t0, %t1
|
|
|
|
ret i16 %t2
|
2008-10-17 09:23:35 +08:00
|
|
|
}
|