default: llvm_unreachable("Unsupported VT!");
case MVT::i8:
LoReg = X86::AL; ClrReg = HiReg = X86::AH;
- SExtOpcode = X86::CBW;
+ SExtOpcode = 0; // Not used.
break;
case MVT::i16:
LoReg = X86::AX; HiReg = X86::DX;
bool signBitIsZero = CurDAG->SignBitIsZero(N0);
SDValue InFlag;
- if (NVT == MVT::i8 && (!isSigned || signBitIsZero)) {
+ if (NVT == MVT::i8) {
// Special case for div8, just use a move with zero extension to AX to
// clear the upper 8 bits (AH).
SDValue Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, Chain;
MachineSDNode *Move;
if (tryFoldLoad(Node, N0, Tmp0, Tmp1, Tmp2, Tmp3, Tmp4)) {
SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, N0.getOperand(0) };
- Move = CurDAG->getMachineNode(X86::MOVZX16rm8, dl, MVT::i32,
- MVT::Other, Ops);
+ unsigned Opc = (isSigned && !signBitIsZero) ? X86::MOVSX16rm8
+ : X86::MOVZX16rm8;
+ Move = CurDAG->getMachineNode(Opc, dl, MVT::i16, MVT::Other, Ops);
Chain = SDValue(Move, 1);
ReplaceUses(N0.getValue(1), Chain);
// Record the mem-refs
CurDAG->setNodeMemRefs(Move, {cast<LoadSDNode>(N0)->getMemOperand()});
} else {
- Move = CurDAG->getMachineNode(X86::MOVZX16rr8, dl, MVT::i32, N0);
+ unsigned Opc = (isSigned && !signBitIsZero) ? X86::MOVSX16rr8
+ : X86::MOVZX16rr8;
+ Move = CurDAG->getMachineNode(Opc, dl, MVT::i16, N0);
Chain = CurDAG->getEntryNode();
}
Chain = CurDAG->getCopyToReg(Chain, dl, X86::AX, SDValue(Move, 0),
; CHECK-LABEL: main:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movq {{.*#+}} xmm0 = mem[0],zero
-; CHECK-NEXT: pextrb $1, %xmm0, %eax
+; CHECK-NEXT: pextrb $1, %xmm0, %ecx
; CHECK-NEXT: movq {{.*#+}} xmm1 = mem[0],zero
-; CHECK-NEXT: pextrb $1, %xmm1, %ecx
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
+; CHECK-NEXT: pextrb $1, %xmm1, %eax
; CHECK-NEXT: cbtw
+; CHECK-NEXT: pextrb $0, %xmm0, %edx
+; CHECK-NEXT: pextrb $0, %xmm1, %esi
; CHECK-NEXT: idivb %cl
; CHECK-NEXT: movl %eax, %ecx
-; CHECK-NEXT: pextrb $0, %xmm0, %eax
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
-; CHECK-NEXT: cbtw
-; CHECK-NEXT: pextrb $0, %xmm1, %edx
+; CHECK-NEXT: movsbl %sil, %eax
; CHECK-NEXT: idivb %dl
; CHECK-NEXT: movzbl %cl, %ecx
; CHECK-NEXT: movzbl %al, %eax
; X86-LABEL: scalar_i8:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
-; X86-NEXT: movb {{[0-9]+}}(%esp), %cl
-; X86-NEXT: movl %ecx, %eax
-; X86-NEXT: cbtw
; X86-NEXT: movb {{[0-9]+}}(%esp), %ch
+; X86-NEXT: movb {{[0-9]+}}(%esp), %cl
+; X86-NEXT: movsbl %cl, %eax
; X86-NEXT: idivb %ch
; X86-NEXT: movb %al, (%edx)
; X86-NEXT: mulb %ch
;
; X64-LABEL: scalar_i8:
; X64: # %bb.0:
-; X64-NEXT: movl %edi, %eax
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl %dil, %ecx
+; X64-NEXT: movl %ecx, %eax
; X64-NEXT: idivb %sil
; X64-NEXT: movb %al, (%rdx)
; X64-NEXT: mulb %sil
-; X64-NEXT: subb %al, %dil
-; X64-NEXT: movl %edi, %eax
+; X64-NEXT: subb %al, %cl
+; X64-NEXT: movl %ecx, %eax
; X64-NEXT: retq
%div = sdiv i8 %x, %y
store i8 %div, i8* %divdst, align 4
; X86-NEXT: subl $48, %esp
; X86-NEXT: movdqa %xmm0, (%esp)
; X86-NEXT: movdqa %xmm1, {{[0-9]+}}(%esp)
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm2
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm3
; X86-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3],xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm4
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm2
; X86-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1],xmm2[2],xmm4[2],xmm2[3],xmm4[3],xmm2[4],xmm4[4],xmm2[5],xmm4[5],xmm2[6],xmm4[6],xmm2[7],xmm4[7]
; X86-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1],xmm2[2],xmm3[2],xmm2[3],xmm3[3]
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm3
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm4
; X86-NEXT: punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1],xmm4[2],xmm3[2],xmm4[3],xmm3[3],xmm4[4],xmm3[4],xmm4[5],xmm3[5],xmm4[6],xmm3[6],xmm4[7],xmm3[7]
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm5
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm3
; X86-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm5[0],xmm3[1],xmm5[1],xmm3[2],xmm5[2],xmm3[3],xmm5[3],xmm3[4],xmm5[4],xmm3[5],xmm5[5],xmm3[6],xmm5[6],xmm3[7],xmm5[7]
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm5
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: movd %eax, %xmm6
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: idivb {{[0-9]+}}(%esp)
+; X86-NEXT: movzbl %al, %edx
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %esi
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %edi
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movzbl %al, %ebx
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
+; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: movl %eax, %ecx
-; X86-NEXT: movb {{[0-9]+}}(%esp), %al
-; X86-NEXT: cbtw
-; X86-NEXT: movb (%esp), %dl
+; X86-NEXT: movsbl (%esp), %eax
; X86-NEXT: idivb {{[0-9]+}}(%esp)
; X86-NEXT: punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1],xmm3[2],xmm4[2],xmm3[3],xmm4[3]
-; X86-NEXT: movd %esi, %xmm4
+; X86-NEXT: movd %edx, %xmm4
; X86-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; X86-NEXT: movd %edi, %xmm2
+; X86-NEXT: movd %esi, %xmm2
; X86-NEXT: punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm5[0],xmm6[1],xmm5[1],xmm6[2],xmm5[2],xmm6[3],xmm5[3],xmm6[4],xmm5[4],xmm6[5],xmm5[5],xmm6[6],xmm5[6],xmm6[7],xmm5[7]
+; X86-NEXT: movd %edi, %xmm5
; X86-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1],xmm2[2],xmm4[2],xmm2[3],xmm4[3],xmm2[4],xmm4[4],xmm2[5],xmm4[5],xmm2[6],xmm4[6],xmm2[7],xmm4[7]
+; X86-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm6[0],xmm2[1],xmm6[1],xmm2[2],xmm6[2],xmm2[3],xmm6[3]
; X86-NEXT: movd %ebx, %xmm4
; X86-NEXT: movzbl %cl, %ecx
-; X86-NEXT: movd %ecx, %xmm5
+; X86-NEXT: movd %ecx, %xmm6
; X86-NEXT: movl 8(%ebp), %ecx
-; X86-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm6[0],xmm2[1],xmm6[1],xmm2[2],xmm6[2],xmm2[3],xmm6[3]
-; X86-NEXT: punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1],xmm5[2],xmm4[2],xmm5[3],xmm4[3],xmm5[4],xmm4[4],xmm5[5],xmm4[5],xmm5[6],xmm4[6],xmm5[7],xmm4[7]
-; X86-NEXT: movzbl %al, %eax
-; X86-NEXT: movd %eax, %xmm4
-; X86-NEXT: movl %edx, %eax
-; X86-NEXT: cbtw
-; X86-NEXT: idivb {{[0-9]+}}(%esp)
+; X86-NEXT: punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1],xmm4[2],xmm5[2],xmm4[3],xmm5[3],xmm4[4],xmm5[4],xmm4[5],xmm5[5],xmm4[6],xmm5[6],xmm4[7],xmm5[7]
; X86-NEXT: movzbl %al, %eax
-; X86-NEXT: movd %eax, %xmm6
-; X86-NEXT: punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1],xmm6[2],xmm4[2],xmm6[3],xmm4[3],xmm6[4],xmm4[4],xmm6[5],xmm4[5],xmm6[6],xmm4[6],xmm6[7],xmm4[7]
-; X86-NEXT: punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm5[0],xmm6[1],xmm5[1],xmm6[2],xmm5[2],xmm6[3],xmm5[3]
-; X86-NEXT: punpckldq {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1]
-; X86-NEXT: movdqa %xmm6, %xmm2
+; X86-NEXT: movd %eax, %xmm5
+; X86-NEXT: punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm6[0],xmm5[1],xmm6[1],xmm5[2],xmm6[2],xmm5[3],xmm6[3],xmm5[4],xmm6[4],xmm5[5],xmm6[5],xmm5[6],xmm6[6],xmm5[7],xmm6[7]
+; X86-NEXT: punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1],xmm5[2],xmm4[2],xmm5[3],xmm4[3]
+; X86-NEXT: punpckldq {{.*#+}} xmm5 = xmm5[0],xmm2[0],xmm5[1],xmm2[1]
+; X86-NEXT: movdqa %xmm5, %xmm2
; X86-NEXT: punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
; X86-NEXT: movdqa %xmm2, (%ecx)
; X86-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7]
; X86-NEXT: pmullw %xmm3, %xmm2
; X86-NEXT: movdqa {{.*#+}} xmm3 = [255,255,255,255,255,255,255,255]
; X86-NEXT: pand %xmm3, %xmm2
-; X86-NEXT: punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm0[0],xmm6[1],xmm0[1],xmm6[2],xmm0[2],xmm6[3],xmm0[3],xmm6[4],xmm0[4],xmm6[5],xmm0[5],xmm6[6],xmm0[6],xmm6[7],xmm0[7]
+; X86-NEXT: punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1],xmm5[2],xmm0[2],xmm5[3],xmm0[3],xmm5[4],xmm0[4],xmm5[5],xmm0[5],xmm5[6],xmm0[6],xmm5[7],xmm0[7]
; X86-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
-; X86-NEXT: pmullw %xmm6, %xmm1
+; X86-NEXT: pmullw %xmm5, %xmm1
; X86-NEXT: pand %xmm3, %xmm1
; X86-NEXT: packuswb %xmm2, %xmm1
; X86-NEXT: psubb %xmm1, %xmm0
; X64-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
; X64-NEXT: movdqa %xmm0, -{{[0-9]+}}(%rsp)
; X64-NEXT: movdqa %xmm1, -{{[0-9]+}}(%rsp)
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: movd %eax, %xmm2
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %r8d
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %r9d
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %r10d
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %r11d
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %r14d
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %r15d
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %r12d
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %r13d
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
+; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
+; X64-NEXT: movzbl %al, %edi
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
+; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
+; X64-NEXT: movzbl %al, %esi
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %ebx
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movzbl %al, %ebp
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
-; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
-; X64-NEXT: movzbl %al, %edi
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
-; X64-NEXT: movzbl %al, %esi
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
+; X64-NEXT: movzbl %al, %edx
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movl %eax, %ecx
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; X64-NEXT: cbtw
-; X64-NEXT: movb -{{[0-9]+}}(%rsp), %dl
+; X64-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
; X64-NEXT: movd %r8d, %xmm3
; X64-NEXT: movd %r9d, %xmm4
; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm6[0],xmm2[1],xmm6[1],xmm2[2],xmm6[2],xmm2[3],xmm6[3],xmm2[4],xmm6[4],xmm2[5],xmm6[5],xmm2[6],xmm6[6],xmm2[7],xmm6[7]
; X64-NEXT: movd %r13d, %xmm6
; X64-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1],xmm3[2],xmm4[2],xmm3[3],xmm4[3],xmm3[4],xmm4[4],xmm3[5],xmm4[5],xmm3[6],xmm4[6],xmm3[7],xmm4[7]
-; X64-NEXT: movd %ebx, %xmm4
+; X64-NEXT: movd %edi, %xmm4
; X64-NEXT: punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
-; X64-NEXT: movd %ebp, %xmm2
+; X64-NEXT: movd %esi, %xmm2
; X64-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm5[0],xmm3[1],xmm5[1]
-; X64-NEXT: movd %edi, %xmm5
+; X64-NEXT: movd %ebx, %xmm5
; X64-NEXT: punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm6[0],xmm4[1],xmm6[1],xmm4[2],xmm6[2],xmm4[3],xmm6[3],xmm4[4],xmm6[4],xmm4[5],xmm6[5],xmm4[6],xmm6[6],xmm4[7],xmm6[7]
-; X64-NEXT: movd %esi, %xmm6
+; X64-NEXT: movd %ebp, %xmm6
; X64-NEXT: punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm2[0],xmm5[1],xmm2[1],xmm5[2],xmm2[2],xmm5[3],xmm2[3],xmm5[4],xmm2[4],xmm5[5],xmm2[5],xmm5[6],xmm2[6],xmm5[7],xmm2[7]
-; X64-NEXT: movzbl %cl, %ecx
-; X64-NEXT: movd %ecx, %xmm2
+; X64-NEXT: movd %edx, %xmm2
; X64-NEXT: punpcklwd {{.*#+}} xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1],xmm5[2],xmm4[2],xmm5[3],xmm4[3]
+; X64-NEXT: movzbl %cl, %ecx
+; X64-NEXT: movd %ecx, %xmm4
; X64-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm6[0],xmm2[1],xmm6[1],xmm2[2],xmm6[2],xmm2[3],xmm6[3],xmm2[4],xmm6[4],xmm2[5],xmm6[5],xmm2[6],xmm6[6],xmm2[7],xmm6[7]
; X64-NEXT: movzbl %al, %eax
-; X64-NEXT: movd %eax, %xmm4
-; X64-NEXT: movl %edx, %eax
-; X64-NEXT: cbtw
-; X64-NEXT: idivb -{{[0-9]+}}(%rsp)
-; X64-NEXT: movzbl %al, %eax
; X64-NEXT: movd %eax, %xmm6
; X64-NEXT: punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm4[0],xmm6[1],xmm4[1],xmm6[2],xmm4[2],xmm6[3],xmm4[3],xmm6[4],xmm4[4],xmm6[5],xmm4[5],xmm6[6],xmm4[6],xmm6[7],xmm4[7]
; X64-NEXT: punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1],xmm6[2],xmm2[2],xmm6[3],xmm2[3]
; X32-LABEL: si8:
; X32: # %bb.0:
; X32-NEXT: pushl %ebx
-; X32-NEXT: movb {{[0-9]+}}(%esp), %al
-; X32-NEXT: cbtw
+; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X32-NEXT: idivb {{[0-9]+}}(%esp)
; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
;
; X64-LABEL: si8:
; X64: # %bb.0:
-; X64-NEXT: movl %edi, %eax
-; X64-NEXT: # kill: def $al killed $al killed $eax
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl %dil, %eax
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %esi
; X64-NEXT: movb %al, (%rdx)
define signext i8 @test_sdivrem_sext_ah(i8 %x, i8 %y) {
; X32-LABEL: test_sdivrem_sext_ah:
; X32: # %bb.0:
-; X32-NEXT: movb {{[0-9]+}}(%esp), %al
-; X32-NEXT: cbtw
+; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X32-NEXT: idivb {{[0-9]+}}(%esp)
; X32-NEXT: movsbl %ah, %ecx
; X32-NEXT: movb %al, z
;
; X64-LABEL: test_sdivrem_sext_ah:
; X64: # %bb.0:
-; X64-NEXT: movl %edi, %eax
-; X64-NEXT: # kill: def $al killed $al killed $eax
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl %dil, %eax
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %ecx
; X64-NEXT: movb %al, {{.*}}(%rip)
define signext i8 @test_srem_sext_ah(i8 %x, i8 %y) {
; X32-LABEL: test_srem_sext_ah:
; X32: # %bb.0:
-; X32-NEXT: movb {{[0-9]+}}(%esp), %al
-; X32-NEXT: cbtw
+; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X32-NEXT: idivb {{[0-9]+}}(%esp)
; X32-NEXT: movsbl %ah, %eax
; X32-NEXT: # kill: def $al killed $al killed $eax
;
; X64-LABEL: test_srem_sext_ah:
; X64: # %bb.0:
-; X64-NEXT: movl %edi, %eax
-; X64-NEXT: # kill: def $al killed $al killed $eax
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl %dil, %eax
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
define i8 @test_srem_noext_ah(i8 %x, i8 %y) {
; X32-LABEL: test_srem_noext_ah:
; X32: # %bb.0:
-; X32-NEXT: movb {{[0-9]+}}(%esp), %al
-; X32-NEXT: cbtw
; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
+; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X32-NEXT: idivb %cl
; X32-NEXT: movsbl %ah, %eax
; X32-NEXT: addb %cl, %al
;
; X64-LABEL: test_srem_noext_ah:
; X64: # %bb.0:
-; X64-NEXT: movl %edi, %eax
-; X64-NEXT: # kill: def $al killed $al killed $eax
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl %dil, %eax
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %eax
; X64-NEXT: addb %sil, %al
define i64 @test_srem_sext64_ah(i8 %x, i8 %y) {
; X32-LABEL: test_srem_sext64_ah:
; X32: # %bb.0:
-; X32-NEXT: movb {{[0-9]+}}(%esp), %al
-; X32-NEXT: cbtw
+; X32-NEXT: movsbl {{[0-9]+}}(%esp), %eax
; X32-NEXT: idivb {{[0-9]+}}(%esp)
; X32-NEXT: movsbl %ah, %eax
; X32-NEXT: movl %eax, %edx
;
; X64-LABEL: test_srem_sext64_ah:
; X64: # %bb.0:
-; X64-NEXT: movl %edi, %eax
-; X64-NEXT: # kill: def $al killed $al killed $eax
-; X64-NEXT: cbtw
+; X64-NEXT: movsbl %dil, %eax
; X64-NEXT: idivb %sil
; X64-NEXT: movsbl %ah, %eax
; X64-NEXT: cltq
define <3 x i8> @test_char_div(<3 x i8> %num, <3 x i8> %div) {
; CHECK-LABEL: test_char_div:
; CHECK: # %bb.0:
-; CHECK-NEXT: movl %edx, %r10d
-; CHECK-NEXT: movl %edi, %eax
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
-; CHECK-NEXT: cbtw
+; CHECK-NEXT: movsbl %dil, %eax
; CHECK-NEXT: idivb %cl
; CHECK-NEXT: movl %eax, %edi
-; CHECK-NEXT: movl %esi, %eax
-; CHECK-NEXT: cbtw
+; CHECK-NEXT: movsbl %sil, %eax
; CHECK-NEXT: idivb %r8b
-; CHECK-NEXT: movl %eax, %edx
-; CHECK-NEXT: movl %r10d, %eax
-; CHECK-NEXT: cbtw
+; CHECK-NEXT: movl %eax, %esi
+; CHECK-NEXT: movsbl %dl, %eax
; CHECK-NEXT: idivb %r9b
; CHECK-NEXT: movl %eax, %ecx
; CHECK-NEXT: movl %edi, %eax
+; CHECK-NEXT: movl %esi, %edx
; CHECK-NEXT: retq
%div.r = sdiv <3 x i8> %num, %div
ret <3 x i8> %div.r
define <4 x i8> @test_char_rem(<4 x i8> %num, <4 x i8> %rem) {
; CHECK-LABEL: test_char_rem:
; CHECK: # %bb.0:
+; CHECK-NEXT: pextrb $1, %xmm1, %ecx
; CHECK-NEXT: pextrb $1, %xmm0, %eax
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: cbtw
-; CHECK-NEXT: pextrb $1, %xmm1, %ecx
; CHECK-NEXT: idivb %cl
; CHECK-NEXT: movsbl %ah, %ecx
+; CHECK-NEXT: pextrb $0, %xmm1, %edx
; CHECK-NEXT: pextrb $0, %xmm0, %eax
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: cbtw
-; CHECK-NEXT: pextrb $0, %xmm1, %edx
; CHECK-NEXT: idivb %dl
; CHECK-NEXT: movsbl %ah, %eax
; CHECK-NEXT: movd %eax, %xmm2
-; CHECK-NEXT: pextrb $2, %xmm0, %eax
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
-; CHECK-NEXT: cbtw
; CHECK-NEXT: pinsrb $1, %ecx, %xmm2
; CHECK-NEXT: pextrb $2, %xmm1, %ecx
+; CHECK-NEXT: pextrb $2, %xmm0, %eax
+; CHECK-NEXT: cbtw
; CHECK-NEXT: idivb %cl
-; CHECK-NEXT: movsbl %ah, %ecx
+; CHECK-NEXT: movsbl %ah, %eax
+; CHECK-NEXT: pinsrb $2, %eax, %xmm2
+; CHECK-NEXT: pextrb $3, %xmm1, %ecx
; CHECK-NEXT: pextrb $3, %xmm0, %eax
-; CHECK-NEXT: # kill: def $al killed $al killed $eax
; CHECK-NEXT: cbtw
-; CHECK-NEXT: pinsrb $2, %ecx, %xmm2
-; CHECK-NEXT: pextrb $3, %xmm1, %ecx
; CHECK-NEXT: idivb %cl
; CHECK-NEXT: movsbl %ah, %eax
; CHECK-NEXT: pinsrb $3, %eax, %xmm2
; SSE2: # %bb.0:
; SSE2-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movaps %xmm1, -{{[0-9]+}}(%rsp)
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm0
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm1
; SSE2-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
-; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
-; SSE2-NEXT: movsbl %ah, %eax
-; SSE2-NEXT: movd %eax, %xmm2
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm0
-; SSE2-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
-; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
-; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
-; SSE2-NEXT: movsbl %ah, %eax
-; SSE2-NEXT: movd %eax, %xmm1
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm2
-; SSE2-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7]
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
+; SSE2-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
-; SSE2-NEXT: movd %eax, %xmm3
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movd %eax, %xmm0
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
-; SSE2-NEXT: movd %eax, %xmm1
-; SSE2-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3],xmm1[4],xmm3[4],xmm1[5],xmm3[5],xmm1[6],xmm3[6],xmm1[7],xmm3[7]
-; SSE2-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
-; SSE2-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movd %eax, %xmm3
+; SSE2-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7]
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm0
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
-; SSE2-NEXT: movd %eax, %xmm3
-; SSE2-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7]
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movd %eax, %xmm1
+; SSE2-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
+; SSE2-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3]
+; SSE2-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm0
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm2
; SSE2-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
-; SSE2-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1],xmm2[2],xmm3[2],xmm2[3],xmm3[3]
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm0
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm3
; SSE2-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7]
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %al
-; SSE2-NEXT: cbtw
-; SSE2-NEXT: movb -{{[0-9]+}}(%rsp), %cl
+; SSE2-NEXT: punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
+; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
+; SSE2-NEXT: movsbl %ah, %eax
+; SSE2-NEXT: movd %eax, %xmm0
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
+; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
+; SSE2-NEXT: movsbl %ah, %eax
+; SSE2-NEXT: movd %eax, %xmm2
+; SSE2-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm4
-; SSE2-NEXT: movl %ecx, %eax
-; SSE2-NEXT: cbtw
+; SSE2-NEXT: movsbl -{{[0-9]+}}(%rsp), %eax
; SSE2-NEXT: idivb -{{[0-9]+}}(%rsp)
; SSE2-NEXT: movsbl %ah, %eax
; SSE2-NEXT: movd %eax, %xmm0
; SSE2-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1],xmm0[2],xmm4[2],xmm0[3],xmm4[3],xmm0[4],xmm4[4],xmm0[5],xmm4[5],xmm0[6],xmm4[6],xmm0[7],xmm4[7]
-; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
-; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
+; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
+; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
; SSE2-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
; SSE2-NEXT: retq
;
; SSE41-LABEL: test_rem_variable_16i8:
; SSE41: # %bb.0:
+; SSE41-NEXT: pextrb $1, %xmm1, %ecx
; SSE41-NEXT: pextrb $1, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pextrb $1, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: pextrb $0, %xmm1, %edx
; SSE41-NEXT: pextrb $0, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pextrb $0, %xmm1, %edx
; SSE41-NEXT: idivb %dl
; SSE41-NEXT: movsbl %ah, %eax
; SSE41-NEXT: movd %eax, %xmm2
-; SSE41-NEXT: pextrb $2, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
-; SSE41-NEXT: cbtw
; SSE41-NEXT: pinsrb $1, %ecx, %xmm2
; SSE41-NEXT: pextrb $2, %xmm1, %ecx
+; SSE41-NEXT: pextrb $2, %xmm0, %eax
+; SSE41-NEXT: cbtw
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $2, %eax, %xmm2
+; SSE41-NEXT: pextrb $3, %xmm1, %ecx
; SSE41-NEXT: pextrb $3, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $2, %ecx, %xmm2
-; SSE41-NEXT: pextrb $3, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $3, %eax, %xmm2
+; SSE41-NEXT: pextrb $4, %xmm1, %ecx
; SSE41-NEXT: pextrb $4, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $3, %ecx, %xmm2
-; SSE41-NEXT: pextrb $4, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $4, %eax, %xmm2
+; SSE41-NEXT: pextrb $5, %xmm1, %ecx
; SSE41-NEXT: pextrb $5, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $4, %ecx, %xmm2
-; SSE41-NEXT: pextrb $5, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $5, %eax, %xmm2
+; SSE41-NEXT: pextrb $6, %xmm1, %ecx
; SSE41-NEXT: pextrb $6, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $5, %ecx, %xmm2
-; SSE41-NEXT: pextrb $6, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $6, %eax, %xmm2
+; SSE41-NEXT: pextrb $7, %xmm1, %ecx
; SSE41-NEXT: pextrb $7, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $6, %ecx, %xmm2
-; SSE41-NEXT: pextrb $7, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $7, %eax, %xmm2
+; SSE41-NEXT: pextrb $8, %xmm1, %ecx
; SSE41-NEXT: pextrb $8, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $7, %ecx, %xmm2
-; SSE41-NEXT: pextrb $8, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $8, %eax, %xmm2
+; SSE41-NEXT: pextrb $9, %xmm1, %ecx
; SSE41-NEXT: pextrb $9, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $8, %ecx, %xmm2
-; SSE41-NEXT: pextrb $9, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $9, %eax, %xmm2
+; SSE41-NEXT: pextrb $10, %xmm1, %ecx
; SSE41-NEXT: pextrb $10, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $9, %ecx, %xmm2
-; SSE41-NEXT: pextrb $10, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $10, %eax, %xmm2
+; SSE41-NEXT: pextrb $11, %xmm1, %ecx
; SSE41-NEXT: pextrb $11, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $10, %ecx, %xmm2
-; SSE41-NEXT: pextrb $11, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $11, %eax, %xmm2
+; SSE41-NEXT: pextrb $12, %xmm1, %ecx
; SSE41-NEXT: pextrb $12, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $11, %ecx, %xmm2
-; SSE41-NEXT: pextrb $12, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $12, %eax, %xmm2
+; SSE41-NEXT: pextrb $13, %xmm1, %ecx
; SSE41-NEXT: pextrb $13, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $12, %ecx, %xmm2
-; SSE41-NEXT: pextrb $13, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $13, %eax, %xmm2
+; SSE41-NEXT: pextrb $14, %xmm1, %ecx
; SSE41-NEXT: pextrb $14, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $13, %ecx, %xmm2
-; SSE41-NEXT: pextrb $14, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
-; SSE41-NEXT: movsbl %ah, %ecx
+; SSE41-NEXT: movsbl %ah, %eax
+; SSE41-NEXT: pinsrb $14, %eax, %xmm2
+; SSE41-NEXT: pextrb $15, %xmm1, %ecx
; SSE41-NEXT: pextrb $15, %xmm0, %eax
-; SSE41-NEXT: # kill: def $al killed $al killed $eax
; SSE41-NEXT: cbtw
-; SSE41-NEXT: pinsrb $14, %ecx, %xmm2
-; SSE41-NEXT: pextrb $15, %xmm1, %ecx
; SSE41-NEXT: idivb %cl
; SSE41-NEXT: movsbl %ah, %eax
; SSE41-NEXT: pinsrb $15, %eax, %xmm2
;
; AVX-LABEL: test_rem_variable_16i8:
; AVX: # %bb.0:
+; AVX-NEXT: vpextrb $1, %xmm1, %ecx
; AVX-NEXT: vpextrb $1, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpextrb $1, %xmm1, %ecx
; AVX-NEXT: idivb %cl
; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: vpextrb $0, %xmm1, %edx
; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpextrb $0, %xmm1, %edx
; AVX-NEXT: idivb %dl
; AVX-NEXT: movsbl %ah, %eax
; AVX-NEXT: vmovd %eax, %xmm2
-; AVX-NEXT: vpextrb $2, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
-; AVX-NEXT: cbtw
; AVX-NEXT: vpinsrb $1, %ecx, %xmm2, %xmm2
; AVX-NEXT: vpextrb $2, %xmm1, %ecx
+; AVX-NEXT: vpextrb $2, %xmm0, %eax
+; AVX-NEXT: cbtw
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $2, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $3, %xmm1, %ecx
; AVX-NEXT: vpextrb $3, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $2, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $3, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $3, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $4, %xmm1, %ecx
; AVX-NEXT: vpextrb $4, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $3, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $4, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $4, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $5, %xmm1, %ecx
; AVX-NEXT: vpextrb $5, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $4, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $5, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $5, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $6, %xmm1, %ecx
; AVX-NEXT: vpextrb $6, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $5, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $6, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $6, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $7, %xmm1, %ecx
; AVX-NEXT: vpextrb $7, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $6, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $7, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $7, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $8, %xmm1, %ecx
; AVX-NEXT: vpextrb $8, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $7, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $8, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $8, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $9, %xmm1, %ecx
; AVX-NEXT: vpextrb $9, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $8, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $9, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $9, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $10, %xmm1, %ecx
; AVX-NEXT: vpextrb $10, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $9, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $10, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $10, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $11, %xmm1, %ecx
; AVX-NEXT: vpextrb $11, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $10, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $11, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $11, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $12, %xmm1, %ecx
; AVX-NEXT: vpextrb $12, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $11, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $12, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $12, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $13, %xmm1, %ecx
; AVX-NEXT: vpextrb $13, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $12, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $13, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $13, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $14, %xmm1, %ecx
; AVX-NEXT: vpextrb $14, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $13, %ecx, %xmm2, %xmm2
-; AVX-NEXT: vpextrb $14, %xmm1, %ecx
; AVX-NEXT: idivb %cl
-; AVX-NEXT: movsbl %ah, %ecx
+; AVX-NEXT: movsbl %ah, %eax
+; AVX-NEXT: vpinsrb $14, %eax, %xmm2, %xmm2
+; AVX-NEXT: vpextrb $15, %xmm1, %ecx
; AVX-NEXT: vpextrb $15, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
; AVX-NEXT: cbtw
-; AVX-NEXT: vpinsrb $14, %ecx, %xmm2, %xmm0
-; AVX-NEXT: vpextrb $15, %xmm1, %ecx
; AVX-NEXT: idivb %cl
; AVX-NEXT: movsbl %ah, %eax
-; AVX-NEXT: vpinsrb $15, %eax, %xmm0, %xmm0
+; AVX-NEXT: vpinsrb $15, %eax, %xmm2, %xmm0
; AVX-NEXT: retq
%res = srem <16 x i8> %a, %b
ret <16 x i8> %res