[llvm] r320400 - [X86] Add AND/OR/XOR schedule tests

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 10:23:24 PST 2017


Author: rksimon
Date: Mon Dec 11 10:23:24 2017
New Revision: 320400

URL: http://llvm.org/viewvc/llvm-project?rev=320400&view=rev
Log:
[X86] Add AND/OR/XOR schedule tests

Modified:
    llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll

Modified: llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll?rev=320400&r1=320399&r2=320400&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll (original)
+++ llvm/trunk/test/CodeGen/X86/schedule-x86_64.ll Mon Dec 11 10:23:24 2017
@@ -1505,787 +1505,1428 @@ define void @test_adox(i32 %a0, i32* %a1
   ret void
 }
 
-; TODO - test_and
-
-define i16 @test_bsf16(i16 %a0, i16* %a1) optsize {
-; GENERIC-LABEL: test_bsf16:
+define void @test_and_8(i8 %a0, i8* %a1) optsize {
+; GENERIC-LABEL: test_and_8:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    bsfw %di, %ax # sched: [3:1.00]
-; GENERIC-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
+; GENERIC-NEXT:    andb $7, %al # sched: [1:0.33]
+; GENERIC-NEXT:    andb $7, %dil # sched: [1:0.33]
+; GENERIC-NEXT:    andb $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    andb %dil, %dil # sched: [1:0.33]
+; GENERIC-NEXT:    andb %dil, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    andb (%rsi), %dil # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
-; GENERIC-NEXT:    orl %ecx, %eax # sched: [1:0.33]
-; GENERIC-NEXT:    # kill: def %ax killed %ax killed %eax
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_bsf16:
+; ATOM-LABEL: test_and_8:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    bsfw %di, %ax # sched: [16:8.00]
-; ATOM-NEXT:    bsfw (%rsi), %cx # sched: [16:8.00]
+; ATOM-NEXT:    andb $7, %al # sched: [1:0.50]
+; ATOM-NEXT:    andb $7, %dil # sched: [1:0.50]
+; ATOM-NEXT:    andb $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    andb %dil, %dil # sched: [1:0.50]
+; ATOM-NEXT:    andb %dil, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    andb (%rsi), %dil # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
-; ATOM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
-; ATOM-NEXT:    # kill: def %ax killed %ax killed %eax
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_bsf16:
+; SLM-LABEL: test_and_8:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    bsfw %di, %ax # sched: [1:1.00]
-; SLM-NEXT:    bsfw (%rsi), %cx # sched: [4:1.00]
+; SLM-NEXT:    andb $7, %al # sched: [1:0.50]
+; SLM-NEXT:    andb $7, %dil # sched: [1:0.50]
+; SLM-NEXT:    andb $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    andb %dil, %dil # sched: [1:0.50]
+; SLM-NEXT:    andb %dil, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    andb (%rsi), %dil # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
-; SLM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
-; SLM-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_bsf16:
+; SANDY-LABEL: test_and_8:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    bsfw %di, %ax # sched: [3:1.00]
-; SANDY-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
+; SANDY-NEXT:    andb $7, %al # sched: [1:0.33]
+; SANDY-NEXT:    andb $7, %dil # sched: [1:0.33]
+; SANDY-NEXT:    andb $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    andb %dil, %dil # sched: [1:0.33]
+; SANDY-NEXT:    andb %dil, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    andb (%rsi), %dil # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
-; SANDY-NEXT:    orl %ecx, %eax # sched: [1:0.33]
-; SANDY-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_bsf16:
+; HASWELL-LABEL: test_and_8:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    bsfw %di, %ax # sched: [3:1.00]
-; HASWELL-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
+; HASWELL-NEXT:    andb $7, %al # sched: [1:0.25]
+; HASWELL-NEXT:    andb $7, %dil # sched: [1:0.25]
+; HASWELL-NEXT:    andb $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    andb %dil, %dil # sched: [1:0.25]
+; HASWELL-NEXT:    andb %dil, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    andb (%rsi), %dil # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
-; HASWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
-; HASWELL-NEXT:    # kill: def %ax killed %ax killed %eax
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_bsf16:
+; BROADWELL-LABEL: test_and_8:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    bsfw %di, %ax # sched: [3:1.00]
-; BROADWELL-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
+; BROADWELL-NEXT:    andb $7, %al # sched: [1:0.25]
+; BROADWELL-NEXT:    andb $7, %dil # sched: [1:0.25]
+; BROADWELL-NEXT:    andb $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    andb %dil, %dil # sched: [1:0.25]
+; BROADWELL-NEXT:    andb %dil, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    andb (%rsi), %dil # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
-; BROADWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
-; BROADWELL-NEXT:    # kill: def %ax killed %ax killed %eax
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_bsf16:
+; SKYLAKE-LABEL: test_and_8:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    bsfw %di, %ax # sched: [3:1.00]
-; SKYLAKE-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
+; SKYLAKE-NEXT:    andb $7, %al # sched: [1:0.25]
+; SKYLAKE-NEXT:    andb $7, %dil # sched: [1:0.25]
+; SKYLAKE-NEXT:    andb $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    andb %dil, %dil # sched: [1:0.25]
+; SKYLAKE-NEXT:    andb %dil, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    andb (%rsi), %dil # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
-; SKYLAKE-NEXT:    orl %ecx, %eax # sched: [1:0.25]
-; SKYLAKE-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_bsf16:
+; SKX-LABEL: test_and_8:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    bsfw %di, %ax # sched: [3:1.00]
-; SKX-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
+; SKX-NEXT:    andb $7, %al # sched: [1:0.25]
+; SKX-NEXT:    andb $7, %dil # sched: [1:0.25]
+; SKX-NEXT:    andb $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    andb %dil, %dil # sched: [1:0.25]
+; SKX-NEXT:    andb %dil, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    andb (%rsi), %dil # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
-; SKX-NEXT:    orl %ecx, %eax # sched: [1:0.25]
-; SKX-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_bsf16:
+; BTVER2-LABEL: test_and_8:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    bsfw %di, %ax # sched: [1:0.50]
-; BTVER2-NEXT:    bsfw (%rsi), %cx # sched: [4:1.00]
+; BTVER2-NEXT:    andb $7, %al # sched: [1:0.50]
+; BTVER2-NEXT:    andb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    andb $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    andb %dil, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    andb %dil, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    andb (%rsi), %dil # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
-; BTVER2-NEXT:    orl %ecx, %eax # sched: [1:0.50]
-; BTVER2-NEXT:    # kill: def %ax killed %ax killed %eax
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_bsf16:
+; ZNVER1-LABEL: test_and_8:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    bsfw %di, %ax # sched: [3:0.25]
-; ZNVER1-NEXT:    bsfw (%rsi), %cx # sched: [7:0.50]
+; ZNVER1-NEXT:    andb $7, %al # sched: [1:0.25]
+; ZNVER1-NEXT:    andb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    andb $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    andb %dil, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    andb %dil, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    andb (%rsi), %dil # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
-; ZNVER1-NEXT:    orl %ecx, %eax # sched: [1:0.25]
-; ZNVER1-NEXT:    # kill: def %ax killed %ax killed %eax
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  %1 = call { i16, i16 } asm sideeffect "bsf $2, $0 \0A\09 bsf $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i16 %a0, i16* %a1)
-  %2 = extractvalue { i16, i16 } %1, 0
-  %3 = extractvalue { i16, i16 } %1, 1
-  %4 = or i16 %2, %3
-  ret i16 %4
+  tail call void asm "andb $2, %AL \0A\09 andb $2, $0 \0A\09 andb $2, $1 \0A\09 andb $0, $0 \0A\09 andb $0, $1 \0A\09 andb $1, $0", "r,*m,i"(i8 %a0, i8* %a1, i8 7) nounwind
+  ret void
 }
-define i32 @test_bsf32(i32 %a0, i32* %a1) optsize {
-; GENERIC-LABEL: test_bsf32:
+define void @test_and_16(i16 %a0, i16* %a1) optsize {
+; GENERIC-LABEL: test_and_16:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
-; GENERIC-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
+; GENERIC-NEXT:    andw $511, %ax # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    andw $511, %di # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    andw $7, %di # sched: [1:0.33]
+; GENERIC-NEXT:    andw $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    andw %di, %di # sched: [1:0.33]
+; GENERIC-NEXT:    andw %di, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    andw (%rsi), %di # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
-; GENERIC-NEXT:    orl %ecx, %eax # sched: [1:0.33]
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_bsf32:
+; ATOM-LABEL: test_and_16:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    bsfl %edi, %eax # sched: [16:8.00]
-; ATOM-NEXT:    bsfl (%rsi), %ecx # sched: [16:8.00]
+; ATOM-NEXT:    andw $511, %ax # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    andw $511, %di # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    andw $7, %di # sched: [1:0.50]
+; ATOM-NEXT:    andw $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    andw %di, %di # sched: [1:0.50]
+; ATOM-NEXT:    andw %di, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    andw (%rsi), %di # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
-; ATOM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_bsf32:
+; SLM-LABEL: test_and_16:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    bsfl %edi, %eax # sched: [1:1.00]
-; SLM-NEXT:    bsfl (%rsi), %ecx # sched: [4:1.00]
+; SLM-NEXT:    andw $511, %ax # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    andw $511, %di # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    andw $7, %di # sched: [1:0.50]
+; SLM-NEXT:    andw $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    andw %di, %di # sched: [1:0.50]
+; SLM-NEXT:    andw %di, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    andw (%rsi), %di # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
-; SLM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_bsf32:
+; SANDY-LABEL: test_and_16:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
-; SANDY-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
+; SANDY-NEXT:    andw $511, %ax # imm = 0x1FF
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    andw $511, %di # imm = 0x1FF
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    andw $7, %di # sched: [1:0.33]
+; SANDY-NEXT:    andw $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    andw %di, %di # sched: [1:0.33]
+; SANDY-NEXT:    andw %di, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    andw (%rsi), %di # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
-; SANDY-NEXT:    orl %ecx, %eax # sched: [1:0.33]
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_bsf32:
+; HASWELL-LABEL: test_and_16:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
-; HASWELL-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
+; HASWELL-NEXT:    andw $511, %ax # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    andw $511, %di # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    andw $7, %di # sched: [1:0.25]
+; HASWELL-NEXT:    andw $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    andw %di, %di # sched: [1:0.25]
+; HASWELL-NEXT:    andw %di, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    andw (%rsi), %di # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
-; HASWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_bsf32:
+; BROADWELL-LABEL: test_and_16:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
-; BROADWELL-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
+; BROADWELL-NEXT:    andw $511, %ax # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    andw $511, %di # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    andw $7, %di # sched: [1:0.25]
+; BROADWELL-NEXT:    andw $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    andw %di, %di # sched: [1:0.25]
+; BROADWELL-NEXT:    andw %di, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    andw (%rsi), %di # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
-; BROADWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_bsf32:
+; SKYLAKE-LABEL: test_and_16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
-; SKYLAKE-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
+; SKYLAKE-NEXT:    andw $511, %ax # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    andw $511, %di # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    andw $7, %di # sched: [1:0.25]
+; SKYLAKE-NEXT:    andw $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    andw %di, %di # sched: [1:0.25]
+; SKYLAKE-NEXT:    andw %di, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    andw (%rsi), %di # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
-; SKYLAKE-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_bsf32:
+; SKX-LABEL: test_and_16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
-; SKX-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
+; SKX-NEXT:    andw $511, %ax # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    andw $511, %di # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    andw $7, %di # sched: [1:0.25]
+; SKX-NEXT:    andw $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    andw %di, %di # sched: [1:0.25]
+; SKX-NEXT:    andw %di, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    andw (%rsi), %di # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
-; SKX-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_bsf32:
+; BTVER2-LABEL: test_and_16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    bsfl %edi, %eax # sched: [1:0.50]
-; BTVER2-NEXT:    bsfl (%rsi), %ecx # sched: [4:1.00]
+; BTVER2-NEXT:    andw $511, %ax # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    andw $511, %di # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    andw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    andw $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    andw %di, %di # sched: [1:0.50]
+; BTVER2-NEXT:    andw %di, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    andw (%rsi), %di # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
-; BTVER2-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_bsf32:
+; ZNVER1-LABEL: test_and_16:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    bsfl %edi, %eax # sched: [3:0.25]
-; ZNVER1-NEXT:    bsfl (%rsi), %ecx # sched: [7:0.50]
+; ZNVER1-NEXT:    andw $511, %ax # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    andw $511, %di # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    andw $511, (%rsi) # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    andw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    andw $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    andw %di, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    andw %di, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    andw (%rsi), %di # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
-; ZNVER1-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  %1 = call { i32, i32 } asm sideeffect "bsf $2, $0 \0A\09 bsf $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i32 %a0, i32* %a1)
-  %2 = extractvalue { i32, i32 } %1, 0
-  %3 = extractvalue { i32, i32 } %1, 1
-  %4 = or i32 %2, %3
-  ret i32 %4
+  tail call void asm "andw $2, %AX \0A\09 andw $2, $0 \0A\09 andw $2, $1 \0A\09 andw $3, $0 \0A\09 andw $3, $1 \0A\09 andw $0, $0 \0A\09 andw $0, $1 \0A\09 andw $1, $0", "r,*m,i,i"(i16 %a0, i16* %a1, i16 511, i8 7) nounwind
+  ret void
 }
-define i64 @test_bsf64(i64 %a0, i64* %a1) optsize {
-; GENERIC-LABEL: test_bsf64:
+define void @test_and_32(i32 %a0, i32* %a1) optsize {
+; GENERIC-LABEL: test_and_32:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
-; GENERIC-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
+; GENERIC-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    andl $7, %edi # sched: [1:0.33]
+; GENERIC-NEXT:    andl $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    andl %edi, %edi # sched: [1:0.33]
+; GENERIC-NEXT:    andl %edi, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    andl (%rsi), %edi # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
-; GENERIC-NEXT:    orq %rcx, %rax # sched: [1:0.33]
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_bsf64:
+; ATOM-LABEL: test_and_32:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    bsfq %rdi, %rax # sched: [16:8.00]
-; ATOM-NEXT:    bsfq (%rsi), %rcx # sched: [16:8.00]
+; ATOM-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    andl $7, %edi # sched: [1:0.50]
+; ATOM-NEXT:    andl $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    andl %edi, %edi # sched: [1:0.50]
+; ATOM-NEXT:    andl %edi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    andl (%rsi), %edi # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
-; ATOM-NEXT:    orq %rcx, %rax # sched: [1:0.50]
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_bsf64:
+; SLM-LABEL: test_and_32:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    bsfq %rdi, %rax # sched: [1:1.00]
-; SLM-NEXT:    bsfq (%rsi), %rcx # sched: [4:1.00]
+; SLM-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    andl $7, %edi # sched: [1:0.50]
+; SLM-NEXT:    andl $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    andl %edi, %edi # sched: [1:0.50]
+; SLM-NEXT:    andl %edi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    andl (%rsi), %edi # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
-; SLM-NEXT:    orq %rcx, %rax # sched: [1:0.50]
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_bsf64:
+; SANDY-LABEL: test_and_32:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
-; SANDY-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
+; SANDY-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    andl $7, %edi # sched: [1:0.33]
+; SANDY-NEXT:    andl $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    andl %edi, %edi # sched: [1:0.33]
+; SANDY-NEXT:    andl %edi, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    andl (%rsi), %edi # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
-; SANDY-NEXT:    orq %rcx, %rax # sched: [1:0.33]
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_bsf64:
+; HASWELL-LABEL: test_and_32:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
-; HASWELL-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
+; HASWELL-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    andl $7, %edi # sched: [1:0.25]
+; HASWELL-NEXT:    andl $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    andl %edi, %edi # sched: [1:0.25]
+; HASWELL-NEXT:    andl %edi, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    andl (%rsi), %edi # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
-; HASWELL-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_bsf64:
+; BROADWELL-LABEL: test_and_32:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
-; BROADWELL-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
+; BROADWELL-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    andl $7, %edi # sched: [1:0.25]
+; BROADWELL-NEXT:    andl $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    andl %edi, %edi # sched: [1:0.25]
+; BROADWELL-NEXT:    andl %edi, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    andl (%rsi), %edi # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
-; BROADWELL-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_bsf64:
+; SKYLAKE-LABEL: test_and_32:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
-; SKYLAKE-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
+; SKYLAKE-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    andl $7, %edi # sched: [1:0.25]
+; SKYLAKE-NEXT:    andl $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    andl %edi, %edi # sched: [1:0.25]
+; SKYLAKE-NEXT:    andl %edi, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    andl (%rsi), %edi # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
-; SKYLAKE-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_bsf64:
+; SKX-LABEL: test_and_32:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
-; SKX-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
+; SKX-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    andl $7, %edi # sched: [1:0.25]
+; SKX-NEXT:    andl $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    andl %edi, %edi # sched: [1:0.25]
+; SKX-NEXT:    andl %edi, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    andl (%rsi), %edi # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
-; SKX-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_bsf64:
+; BTVER2-LABEL: test_and_32:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    bsfq %rdi, %rax # sched: [1:0.50]
-; BTVER2-NEXT:    bsfq (%rsi), %rcx # sched: [4:1.00]
+; BTVER2-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    andl $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    andl $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    andl %edi, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    andl %edi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    andl (%rsi), %edi # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
-; BTVER2-NEXT:    orq %rcx, %rax # sched: [1:0.50]
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_bsf64:
+; ZNVER1-LABEL: test_and_32:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    bsfq %rdi, %rax # sched: [3:0.25]
-; ZNVER1-NEXT:    bsfq (%rsi), %rcx # sched: [7:0.50]
+; ZNVER1-NEXT:    andl $665536, %eax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    andl $665536, %edi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    andl $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    andl $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    andl $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    andl %edi, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    andl %edi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    andl (%rsi), %edi # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
-; ZNVER1-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  %1 = call { i64, i64 } asm sideeffect "bsf $2, $0 \0A\09 bsf $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i64 %a0, i64* %a1)
-  %2 = extractvalue { i64, i64 } %1, 0
-  %3 = extractvalue { i64, i64 } %1, 1
-  %4 = or i64 %2, %3
-  ret i64 %4
+  tail call void asm "andl $2, %EAX \0A\09 andl $2, $0 \0A\09 andl $2, $1 \0A\09 andl $3, $0 \0A\09 andl $3, $1 \0A\09 andl $0, $0 \0A\09 andl $0, $1 \0A\09 andl $1, $0", "r,*m,i,i"(i32 %a0, i32* %a1, i32 665536, i8 7) nounwind
+  ret void
 }
-
-define i16 @test_bsr16(i16 %a0, i16* %a1) optsize {
-; GENERIC-LABEL: test_bsr16:
+define void @test_and_64(i64 %a0, i64* %a1) optsize {
+; GENERIC-LABEL: test_and_64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    bsrw %di, %ax # sched: [3:1.00]
-; GENERIC-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; GENERIC-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    andq $7, %rdi # sched: [1:0.33]
+; GENERIC-NEXT:    andq $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    andq %rdi, %rdi # sched: [1:0.33]
+; GENERIC-NEXT:    andq %rdi, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    andq (%rsi), %rdi # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
-; GENERIC-NEXT:    orl %ecx, %eax # sched: [1:0.33]
-; GENERIC-NEXT:    # kill: def %ax killed %ax killed %eax
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_bsr16:
+; ATOM-LABEL: test_and_64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    bsrw %di, %ax # sched: [16:8.00]
-; ATOM-NEXT:    bsrw (%rsi), %cx # sched: [16:8.00]
+; ATOM-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    andq $7, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    andq $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    andq %rdi, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    andq %rdi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    andq (%rsi), %rdi # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
-; ATOM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
-; ATOM-NEXT:    # kill: def %ax killed %ax killed %eax
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_bsr16:
+; SLM-LABEL: test_and_64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    bsrw %di, %ax # sched: [1:1.00]
-; SLM-NEXT:    bsrw (%rsi), %cx # sched: [4:1.00]
+; SLM-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    andq $7, %rdi # sched: [1:0.50]
+; SLM-NEXT:    andq $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    andq %rdi, %rdi # sched: [1:0.50]
+; SLM-NEXT:    andq %rdi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    andq (%rsi), %rdi # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
-; SLM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
-; SLM-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_bsr16:
+; SANDY-LABEL: test_and_64:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    bsrw %di, %ax # sched: [3:1.00]
-; SANDY-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; SANDY-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    andq $7, %rdi # sched: [1:0.33]
+; SANDY-NEXT:    andq $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    andq %rdi, %rdi # sched: [1:0.33]
+; SANDY-NEXT:    andq %rdi, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    andq (%rsi), %rdi # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
-; SANDY-NEXT:    orl %ecx, %eax # sched: [1:0.33]
-; SANDY-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_bsr16:
+; HASWELL-LABEL: test_and_64:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    bsrw %di, %ax # sched: [3:1.00]
-; HASWELL-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; HASWELL-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    andq $7, %rdi # sched: [1:0.25]
+; HASWELL-NEXT:    andq $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    andq %rdi, %rdi # sched: [1:0.25]
+; HASWELL-NEXT:    andq %rdi, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    andq (%rsi), %rdi # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
-; HASWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
-; HASWELL-NEXT:    # kill: def %ax killed %ax killed %eax
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_bsr16:
+; BROADWELL-LABEL: test_and_64:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    bsrw %di, %ax # sched: [3:1.00]
-; BROADWELL-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; BROADWELL-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    andq $7, %rdi # sched: [1:0.25]
+; BROADWELL-NEXT:    andq $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    andq %rdi, %rdi # sched: [1:0.25]
+; BROADWELL-NEXT:    andq %rdi, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    andq (%rsi), %rdi # sched: [6:0.50]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_and_64:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    andq $7, %rdi # sched: [1:0.25]
+; SKYLAKE-NEXT:    andq $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    andq %rdi, %rdi # sched: [1:0.25]
+; SKYLAKE-NEXT:    andq %rdi, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    andq (%rsi), %rdi # sched: [6:0.50]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_and_64:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    andq $7, %rdi # sched: [1:0.25]
+; SKX-NEXT:    andq $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    andq %rdi, %rdi # sched: [1:0.25]
+; SKX-NEXT:    andq %rdi, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    andq (%rsi), %rdi # sched: [6:0.50]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_and_64:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    andq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    andq $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    andq %rdi, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    andq %rdi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    andq (%rsi), %rdi # sched: [4:1.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_and_64:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    andq $665536, %rax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    andq $665536, %rdi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    andq $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    andq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    andq $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    andq %rdi, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    andq %rdi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    andq (%rsi), %rdi # sched: [5:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  tail call void asm "andq $2, %RAX \0A\09 andq $2, $0 \0A\09 andq $2, $1 \0A\09 andq $3, $0 \0A\09 andq $3, $1 \0A\09 andq $0, $0 \0A\09 andq $0, $1 \0A\09 andq $1, $0", "r,*m,i,i"(i64 %a0, i64* %a1, i32 665536, i8 7) nounwind
+  ret void
+}
+
+define i16 @test_bsf16(i16 %a0, i16* %a1) optsize {
+; GENERIC-LABEL: test_bsf16:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    bsfw %di, %ax # sched: [3:1.00]
+; GENERIC-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    orl %ecx, %eax # sched: [1:0.33]
+; GENERIC-NEXT:    # kill: def %ax killed %ax killed %eax
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_bsf16:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    bsfw %di, %ax # sched: [16:8.00]
+; ATOM-NEXT:    bsfw (%rsi), %cx # sched: [16:8.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
+; ATOM-NEXT:    # kill: def %ax killed %ax killed %eax
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_bsf16:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    bsfw %di, %ax # sched: [1:1.00]
+; SLM-NEXT:    bsfw (%rsi), %cx # sched: [4:1.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
+; SLM-NEXT:    # kill: def %ax killed %ax killed %eax
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_bsf16:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    bsfw %di, %ax # sched: [3:1.00]
+; SANDY-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    orl %ecx, %eax # sched: [1:0.33]
+; SANDY-NEXT:    # kill: def %ax killed %ax killed %eax
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_bsf16:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    bsfw %di, %ax # sched: [3:1.00]
+; HASWELL-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
+; HASWELL-NEXT:    # kill: def %ax killed %ax killed %eax
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_bsf16:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    bsfw %di, %ax # sched: [3:1.00]
+; BROADWELL-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; BROADWELL-NEXT:    # kill: def %ax killed %ax killed %eax
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_bsr16:
+; SKYLAKE-LABEL: test_bsf16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    bsrw %di, %ax # sched: [3:1.00]
-; SKYLAKE-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; SKYLAKE-NEXT:    bsfw %di, %ax # sched: [3:1.00]
+; SKYLAKE-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; SKYLAKE-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_bsr16:
+; SKX-LABEL: test_bsf16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    bsrw %di, %ax # sched: [3:1.00]
-; SKX-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; SKX-NEXT:    bsfw %di, %ax # sched: [3:1.00]
+; SKX-NEXT:    bsfw (%rsi), %cx # sched: [8:1.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; SKX-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_bsr16:
+; BTVER2-LABEL: test_bsf16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    bsrw %di, %ax # sched: [1:0.50]
-; BTVER2-NEXT:    bsrw (%rsi), %cx # sched: [4:1.00]
+; BTVER2-NEXT:    bsfw %di, %ax # sched: [1:0.50]
+; BTVER2-NEXT:    bsfw (%rsi), %cx # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; BTVER2-NEXT:    # kill: def %ax killed %ax killed %eax
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_bsr16:
+; ZNVER1-LABEL: test_bsf16:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    bsrw %di, %ax # sched: [3:0.25]
-; ZNVER1-NEXT:    bsrw (%rsi), %cx # sched: [7:0.50]
+; ZNVER1-NEXT:    bsfw %di, %ax # sched: [3:0.25]
+; ZNVER1-NEXT:    bsfw (%rsi), %cx # sched: [7:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; ZNVER1-NEXT:    # kill: def %ax killed %ax killed %eax
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  %1 = call { i16, i16 } asm sideeffect "bsr $2, $0 \0A\09 bsr $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i16 %a0, i16* %a1)
+  %1 = call { i16, i16 } asm sideeffect "bsf $2, $0 \0A\09 bsf $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i16 %a0, i16* %a1)
   %2 = extractvalue { i16, i16 } %1, 0
   %3 = extractvalue { i16, i16 } %1, 1
   %4 = or i16 %2, %3
   ret i16 %4
 }
-define i32 @test_bsr32(i32 %a0, i32* %a1) optsize {
-; GENERIC-LABEL: test_bsr32:
+define i32 @test_bsf32(i32 %a0, i32* %a1) optsize {
+; GENERIC-LABEL: test_bsf32:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
-; GENERIC-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; GENERIC-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
+; GENERIC-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    orl %ecx, %eax # sched: [1:0.33]
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_bsr32:
+; ATOM-LABEL: test_bsf32:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    bsrl %edi, %eax # sched: [16:8.00]
-; ATOM-NEXT:    bsrl (%rsi), %ecx # sched: [16:8.00]
+; ATOM-NEXT:    bsfl %edi, %eax # sched: [16:8.00]
+; ATOM-NEXT:    bsfl (%rsi), %ecx # sched: [16:8.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_bsr32:
+; SLM-LABEL: test_bsf32:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    bsrl %edi, %eax # sched: [1:1.00]
-; SLM-NEXT:    bsrl (%rsi), %ecx # sched: [4:1.00]
+; SLM-NEXT:    bsfl %edi, %eax # sched: [1:1.00]
+; SLM-NEXT:    bsfl (%rsi), %ecx # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_bsr32:
+; SANDY-LABEL: test_bsf32:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
-; SANDY-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; SANDY-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
+; SANDY-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    orl %ecx, %eax # sched: [1:0.33]
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_bsr32:
+; HASWELL-LABEL: test_bsf32:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
-; HASWELL-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; HASWELL-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
+; HASWELL-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_bsr32:
+; BROADWELL-LABEL: test_bsf32:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
-; BROADWELL-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; BROADWELL-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
+; BROADWELL-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_bsr32:
+; SKYLAKE-LABEL: test_bsf32:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
-; SKYLAKE-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; SKYLAKE-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
+; SKYLAKE-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_bsr32:
+; SKX-LABEL: test_bsf32:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
-; SKX-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; SKX-NEXT:    bsfl %edi, %eax # sched: [3:1.00]
+; SKX-NEXT:    bsfl (%rsi), %ecx # sched: [8:1.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_bsr32:
+; BTVER2-LABEL: test_bsf32:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    bsrl %edi, %eax # sched: [1:0.50]
-; BTVER2-NEXT:    bsrl (%rsi), %ecx # sched: [4:1.00]
+; BTVER2-NEXT:    bsfl %edi, %eax # sched: [1:0.50]
+; BTVER2-NEXT:    bsfl (%rsi), %ecx # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_bsr32:
+; ZNVER1-LABEL: test_bsf32:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    bsrl %edi, %eax # sched: [3:0.25]
-; ZNVER1-NEXT:    bsrl (%rsi), %ecx # sched: [7:0.50]
+; ZNVER1-NEXT:    bsfl %edi, %eax # sched: [3:0.25]
+; ZNVER1-NEXT:    bsfl (%rsi), %ecx # sched: [7:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  %1 = call { i32, i32 } asm sideeffect "bsr $2, $0 \0A\09 bsr $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i32 %a0, i32* %a1)
+  %1 = call { i32, i32 } asm sideeffect "bsf $2, $0 \0A\09 bsf $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i32 %a0, i32* %a1)
   %2 = extractvalue { i32, i32 } %1, 0
   %3 = extractvalue { i32, i32 } %1, 1
   %4 = or i32 %2, %3
   ret i32 %4
 }
-define i64 @test_bsr64(i64 %a0, i64* %a1) optsize {
-; GENERIC-LABEL: test_bsr64:
+define i64 @test_bsf64(i64 %a0, i64* %a1) optsize {
+; GENERIC-LABEL: test_bsf64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
-; GENERIC-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; GENERIC-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
+; GENERIC-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    orq %rcx, %rax # sched: [1:0.33]
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_bsr64:
+; ATOM-LABEL: test_bsf64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    bsrq %rdi, %rax # sched: [16:8.00]
-; ATOM-NEXT:    bsrq (%rsi), %rcx # sched: [16:8.00]
+; ATOM-NEXT:    bsfq %rdi, %rax # sched: [16:8.00]
+; ATOM-NEXT:    bsfq (%rsi), %rcx # sched: [16:8.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    orq %rcx, %rax # sched: [1:0.50]
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_bsr64:
+; SLM-LABEL: test_bsf64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    bsrq %rdi, %rax # sched: [1:1.00]
-; SLM-NEXT:    bsrq (%rsi), %rcx # sched: [4:1.00]
+; SLM-NEXT:    bsfq %rdi, %rax # sched: [1:1.00]
+; SLM-NEXT:    bsfq (%rsi), %rcx # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    orq %rcx, %rax # sched: [1:0.50]
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_bsr64:
+; SANDY-LABEL: test_bsf64:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
-; SANDY-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; SANDY-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
+; SANDY-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    orq %rcx, %rax # sched: [1:0.33]
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_bsr64:
+; HASWELL-LABEL: test_bsf64:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
-; HASWELL-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; HASWELL-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
+; HASWELL-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_bsr64:
+; BROADWELL-LABEL: test_bsf64:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
-; BROADWELL-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; BROADWELL-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
+; BROADWELL-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_bsr64:
+; SKYLAKE-LABEL: test_bsf64:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
-; SKYLAKE-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; SKYLAKE-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
+; SKYLAKE-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_bsr64:
+; SKX-LABEL: test_bsf64:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
-; SKX-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; SKX-NEXT:    bsfq %rdi, %rax # sched: [3:1.00]
+; SKX-NEXT:    bsfq (%rsi), %rcx # sched: [8:1.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_bsr64:
+; BTVER2-LABEL: test_bsf64:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    bsrq %rdi, %rax # sched: [1:0.50]
-; BTVER2-NEXT:    bsrq (%rsi), %rcx # sched: [4:1.00]
+; BTVER2-NEXT:    bsfq %rdi, %rax # sched: [1:0.50]
+; BTVER2-NEXT:    bsfq (%rsi), %rcx # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    orq %rcx, %rax # sched: [1:0.50]
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_bsr64:
+; ZNVER1-LABEL: test_bsf64:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    bsrq %rdi, %rax # sched: [3:0.25]
-; ZNVER1-NEXT:    bsrq (%rsi), %rcx # sched: [7:0.50]
+; ZNVER1-NEXT:    bsfq %rdi, %rax # sched: [3:0.25]
+; ZNVER1-NEXT:    bsfq (%rsi), %rcx # sched: [7:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    orq %rcx, %rax # sched: [1:0.25]
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  %1 = call { i64, i64 } asm sideeffect "bsr $2, $0 \0A\09 bsr $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i64 %a0, i64* %a1)
+  %1 = call { i64, i64 } asm sideeffect "bsf $2, $0 \0A\09 bsf $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i64 %a0, i64* %a1)
   %2 = extractvalue { i64, i64 } %1, 0
   %3 = extractvalue { i64, i64 } %1, 1
   %4 = or i64 %2, %3
   ret i64 %4
 }
 
-define i32 @test_bswap32(i32 %a0) optsize {
-; GENERIC-LABEL: test_bswap32:
+define i16 @test_bsr16(i16 %a0, i16* %a1) optsize {
+; GENERIC-LABEL: test_bsr16:
 ; GENERIC:       # %bb.0:
-; GENERIC-NEXT:    bswapl %edi # sched: [2:1.00]
-; GENERIC-NEXT:    movl %edi, %eax # sched: [1:0.33]
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    bsrw %di, %ax # sched: [3:1.00]
+; GENERIC-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    orl %ecx, %eax # sched: [1:0.33]
+; GENERIC-NEXT:    # kill: def %ax killed %ax killed %eax
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_bswap32:
+; ATOM-LABEL: test_bsr16:
 ; ATOM:       # %bb.0:
-; ATOM-NEXT:    bswapl %edi # sched: [1:1.00]
-; ATOM-NEXT:    movl %edi, %eax # sched: [1:0.50]
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    bsrw %di, %ax # sched: [16:8.00]
+; ATOM-NEXT:    bsrw (%rsi), %cx # sched: [16:8.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
+; ATOM-NEXT:    # kill: def %ax killed %ax killed %eax
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_bswap32:
+; SLM-LABEL: test_bsr16:
 ; SLM:       # %bb.0:
-; SLM-NEXT:    bswapl %edi # sched: [1:0.50]
-; SLM-NEXT:    movl %edi, %eax # sched: [1:0.50]
+; SLM-NEXT:    #APP
+; SLM-NEXT:    bsrw %di, %ax # sched: [1:1.00]
+; SLM-NEXT:    bsrw (%rsi), %cx # sched: [4:1.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
+; SLM-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_bswap32:
+; SANDY-LABEL: test_bsr16:
 ; SANDY:       # %bb.0:
-; SANDY-NEXT:    bswapl %edi # sched: [2:1.00]
-; SANDY-NEXT:    movl %edi, %eax # sched: [1:0.33]
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    bsrw %di, %ax # sched: [3:1.00]
+; SANDY-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    orl %ecx, %eax # sched: [1:0.33]
+; SANDY-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_bswap32:
+; HASWELL-LABEL: test_bsr16:
 ; HASWELL:       # %bb.0:
-; HASWELL-NEXT:    bswapl %edi # sched: [2:0.50]
-; HASWELL-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    bsrw %di, %ax # sched: [3:1.00]
+; HASWELL-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
+; HASWELL-NEXT:    # kill: def %ax killed %ax killed %eax
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_bswap32:
+; BROADWELL-LABEL: test_bsr16:
 ; BROADWELL:       # %bb.0:
-; BROADWELL-NEXT:    bswapl %edi # sched: [2:0.50]
-; BROADWELL-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    bsrw %di, %ax # sched: [3:1.00]
+; BROADWELL-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
+; BROADWELL-NEXT:    # kill: def %ax killed %ax killed %eax
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_bswap32:
+; SKYLAKE-LABEL: test_bsr16:
 ; SKYLAKE:       # %bb.0:
-; SKYLAKE-NEXT:    bswapl %edi # sched: [2:0.50]
-; SKYLAKE-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    bsrw %di, %ax # sched: [3:1.00]
+; SKYLAKE-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    orl %ecx, %eax # sched: [1:0.25]
+; SKYLAKE-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_bswap32:
+; SKX-LABEL: test_bsr16:
 ; SKX:       # %bb.0:
-; SKX-NEXT:    bswapl %edi # sched: [2:0.50]
-; SKX-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; SKX-NEXT:    #APP
+; SKX-NEXT:    bsrw %di, %ax # sched: [3:1.00]
+; SKX-NEXT:    bsrw (%rsi), %cx # sched: [8:1.00]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    orl %ecx, %eax # sched: [1:0.25]
+; SKX-NEXT:    # kill: def %ax killed %ax killed %eax
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_bswap32:
+; BTVER2-LABEL: test_bsr16:
 ; BTVER2:       # %bb.0:
-; BTVER2-NEXT:    bswapl %edi # sched: [1:0.50]
-; BTVER2-NEXT:    movl %edi, %eax # sched: [1:0.50]
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    bsrw %di, %ax # sched: [1:0.50]
+; BTVER2-NEXT:    bsrw (%rsi), %cx # sched: [4:1.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    orl %ecx, %eax # sched: [1:0.50]
+; BTVER2-NEXT:    # kill: def %ax killed %ax killed %eax
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_bswap32:
+; ZNVER1-LABEL: test_bsr16:
 ; ZNVER1:       # %bb.0:
-; ZNVER1-NEXT:    bswapl %edi # sched: [1:1.00]
-; ZNVER1-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    bsrw %di, %ax # sched: [3:0.25]
+; ZNVER1-NEXT:    bsrw (%rsi), %cx # sched: [7:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    orl %ecx, %eax # sched: [1:0.25]
+; ZNVER1-NEXT:    # kill: def %ax killed %ax killed %eax
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  %1 = tail call i32 asm "bswap $0", "=r,0"(i32 %a0) nounwind
-  ret i32 %1
+  %1 = call { i16, i16 } asm sideeffect "bsr $2, $0 \0A\09 bsr $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i16 %a0, i16* %a1)
+  %2 = extractvalue { i16, i16 } %1, 0
+  %3 = extractvalue { i16, i16 } %1, 1
+  %4 = or i16 %2, %3
+  ret i16 %4
 }
-define i64 @test_bswap64(i64 %a0) optsize {
-; GENERIC-LABEL: test_bswap64:
+define i32 @test_bsr32(i32 %a0, i32* %a1) optsize {
+; GENERIC-LABEL: test_bsr32:
 ; GENERIC:       # %bb.0:
-; GENERIC-NEXT:    bswapq %rdi # sched: [2:1.00]
-; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
+; GENERIC-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    orl %ecx, %eax # sched: [1:0.33]
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_bswap64:
+; ATOM-LABEL: test_bsr32:
 ; ATOM:       # %bb.0:
-; ATOM-NEXT:    bswapq %rdi # sched: [1:1.00]
-; ATOM-NEXT:    movq %rdi, %rax # sched: [1:0.50]
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    bsrl %edi, %eax # sched: [16:8.00]
+; ATOM-NEXT:    bsrl (%rsi), %ecx # sched: [16:8.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_bswap64:
+; SLM-LABEL: test_bsr32:
 ; SLM:       # %bb.0:
-; SLM-NEXT:    bswapq %rdi # sched: [1:0.50]
-; SLM-NEXT:    movq %rdi, %rax # sched: [1:0.50]
+; SLM-NEXT:    #APP
+; SLM-NEXT:    bsrl %edi, %eax # sched: [1:1.00]
+; SLM-NEXT:    bsrl (%rsi), %ecx # sched: [4:1.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_bswap64:
+; SANDY-LABEL: test_bsr32:
 ; SANDY:       # %bb.0:
-; SANDY-NEXT:    bswapq %rdi # sched: [2:1.00]
-; SANDY-NEXT:    movq %rdi, %rax # sched: [1:0.33]
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
+; SANDY-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    orl %ecx, %eax # sched: [1:0.33]
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_bswap64:
+; HASWELL-LABEL: test_bsr32:
 ; HASWELL:       # %bb.0:
-; HASWELL-NEXT:    bswapq %rdi # sched: [2:0.50]
-; HASWELL-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
+; HASWELL-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_bswap64:
+; BROADWELL-LABEL: test_bsr32:
 ; BROADWELL:       # %bb.0:
-; BROADWELL-NEXT:    bswapq %rdi # sched: [2:0.50]
-; BROADWELL-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
+; BROADWELL-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_bswap64:
+; SKYLAKE-LABEL: test_bsr32:
 ; SKYLAKE:       # %bb.0:
-; SKYLAKE-NEXT:    bswapq %rdi # sched: [2:0.50]
-; SKYLAKE-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
+; SKYLAKE-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_bswap64:
+; SKX-LABEL: test_bsr32:
 ; SKX:       # %bb.0:
-; SKX-NEXT:    bswapq %rdi # sched: [2:0.50]
-; SKX-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; SKX-NEXT:    #APP
+; SKX-NEXT:    bsrl %edi, %eax # sched: [3:1.00]
+; SKX-NEXT:    bsrl (%rsi), %ecx # sched: [8:1.00]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_bswap64:
+; BTVER2-LABEL: test_bsr32:
 ; BTVER2:       # %bb.0:
-; BTVER2-NEXT:    bswapq %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    movq %rdi, %rax # sched: [1:0.50]
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    bsrl %edi, %eax # sched: [1:0.50]
+; BTVER2-NEXT:    bsrl (%rsi), %ecx # sched: [4:1.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    orl %ecx, %eax # sched: [1:0.50]
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_bswap64:
+; ZNVER1-LABEL: test_bsr32:
 ; ZNVER1:       # %bb.0:
-; ZNVER1-NEXT:    bswapq %rdi # sched: [1:1.00]
-; ZNVER1-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    bsrl %edi, %eax # sched: [3:0.25]
+; ZNVER1-NEXT:    bsrl (%rsi), %ecx # sched: [7:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    orl %ecx, %eax # sched: [1:0.25]
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  %1 = tail call i64 asm "bswap $0", "=r,0"(i64 %a0) nounwind
-  ret i64 %1
+  %1 = call { i32, i32 } asm sideeffect "bsr $2, $0 \0A\09 bsr $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i32 %a0, i32* %a1)
+  %2 = extractvalue { i32, i32 } %1, 0
+  %3 = extractvalue { i32, i32 } %1, 1
+  %4 = or i32 %2, %3
+  ret i32 %4
 }
-
-define void @test_bt_btc_btr_bts_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
-; GENERIC-LABEL: test_bt_btc_btr_bts_16:
+define i64 @test_bsr64(i64 %a0, i64* %a1) optsize {
+; GENERIC-LABEL: test_bsr64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    btw %si, %di # sched: [1:0.50]
-; GENERIC-NEXT:    btcw %si, %di # sched: [1:0.50]
-; GENERIC-NEXT:    btrw %si, %di # sched: [1:0.50]
-; GENERIC-NEXT:    btsw %si, %di # sched: [1:0.50]
-; GENERIC-NEXT:    btw %si, (%rdx) # sched: [9:1.00]
-; GENERIC-NEXT:    btcw %si, (%rdx) # sched: [9:1.00]
-; GENERIC-NEXT:    btrw %si, (%rdx) # sched: [9:1.00]
-; GENERIC-NEXT:    btsw %si, (%rdx) # sched: [9:1.00]
-; GENERIC-NEXT:    btw $7, %di # sched: [1:0.50]
-; GENERIC-NEXT:    btcw $7, %di # sched: [1:0.50]
-; GENERIC-NEXT:    btrw $7, %di # sched: [1:0.50]
-; GENERIC-NEXT:    btsw $7, %di # sched: [1:0.50]
-; GENERIC-NEXT:    btw $7, (%rdx) # sched: [6:0.50]
-; GENERIC-NEXT:    btcw $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    btrw $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    btsw $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
+; GENERIC-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
 ; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    orq %rcx, %rax # sched: [1:0.33]
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_bt_btc_btr_bts_16:
+; ATOM-LABEL: test_bsr64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    btw %si, %di # sched: [1:1.00]
-; ATOM-NEXT:    btcw %si, %di # sched: [1:1.00]
-; ATOM-NEXT:    btrw %si, %di # sched: [1:1.00]
-; ATOM-NEXT:    btsw %si, %di # sched: [1:1.00]
-; ATOM-NEXT:    btw %si, (%rdx) # sched: [9:4.50]
-; ATOM-NEXT:    btcw %si, (%rdx) # sched: [11:5.50]
-; ATOM-NEXT:    btrw %si, (%rdx) # sched: [11:5.50]
-; ATOM-NEXT:    btsw %si, (%rdx) # sched: [11:5.50]
-; ATOM-NEXT:    btw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    btcw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    btrw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    btsw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    btw $7, (%rdx) # sched: [1:0.50]
-; ATOM-NEXT:    btcw $7, (%rdx) # sched: [2:1.00]
-; ATOM-NEXT:    btrw $7, (%rdx) # sched: [2:1.00]
-; ATOM-NEXT:    btsw $7, (%rdx) # sched: [2:1.00]
+; ATOM-NEXT:    bsrq %rdi, %rax # sched: [16:8.00]
+; ATOM-NEXT:    bsrq (%rsi), %rcx # sched: [16:8.00]
 ; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    orq %rcx, %rax # sched: [1:0.50]
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_bt_btc_btr_bts_16:
+; SLM-LABEL: test_bsr64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    btw %si, %di # sched: [1:0.50]
-; SLM-NEXT:    btcw %si, %di # sched: [1:0.50]
-; SLM-NEXT:    btrw %si, %di # sched: [1:0.50]
-; SLM-NEXT:    btsw %si, %di # sched: [1:0.50]
-; SLM-NEXT:    btw %si, (%rdx) # sched: [4:1.00]
-; SLM-NEXT:    btcw %si, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    bsrq %rdi, %rax # sched: [1:1.00]
+; SLM-NEXT:    bsrq (%rsi), %rcx # sched: [4:1.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    orq %rcx, %rax # sched: [1:0.50]
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_bsr64:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
+; SANDY-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    orq %rcx, %rax # sched: [1:0.33]
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_bsr64:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
+; HASWELL-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    orq %rcx, %rax # sched: [1:0.25]
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_bsr64:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
+; BROADWELL-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    orq %rcx, %rax # sched: [1:0.25]
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_bsr64:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
+; SKYLAKE-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    orq %rcx, %rax # sched: [1:0.25]
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_bsr64:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    bsrq %rdi, %rax # sched: [3:1.00]
+; SKX-NEXT:    bsrq (%rsi), %rcx # sched: [8:1.00]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    orq %rcx, %rax # sched: [1:0.25]
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_bsr64:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    bsrq %rdi, %rax # sched: [1:0.50]
+; BTVER2-NEXT:    bsrq (%rsi), %rcx # sched: [4:1.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    orq %rcx, %rax # sched: [1:0.50]
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_bsr64:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    bsrq %rdi, %rax # sched: [3:0.25]
+; ZNVER1-NEXT:    bsrq (%rsi), %rcx # sched: [7:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    orq %rcx, %rax # sched: [1:0.25]
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  %1 = call { i64, i64 } asm sideeffect "bsr $2, $0 \0A\09 bsr $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i64 %a0, i64* %a1)
+  %2 = extractvalue { i64, i64 } %1, 0
+  %3 = extractvalue { i64, i64 } %1, 1
+  %4 = or i64 %2, %3
+  ret i64 %4
+}
+
+define i32 @test_bswap32(i32 %a0) optsize {
+; GENERIC-LABEL: test_bswap32:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    bswapl %edi # sched: [2:1.00]
+; GENERIC-NEXT:    movl %edi, %eax # sched: [1:0.33]
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_bswap32:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    bswapl %edi # sched: [1:1.00]
+; ATOM-NEXT:    movl %edi, %eax # sched: [1:0.50]
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_bswap32:
+; SLM:       # %bb.0:
+; SLM-NEXT:    bswapl %edi # sched: [1:0.50]
+; SLM-NEXT:    movl %edi, %eax # sched: [1:0.50]
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_bswap32:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    bswapl %edi # sched: [2:1.00]
+; SANDY-NEXT:    movl %edi, %eax # sched: [1:0.33]
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_bswap32:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    bswapl %edi # sched: [2:0.50]
+; HASWELL-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_bswap32:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    bswapl %edi # sched: [2:0.50]
+; BROADWELL-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_bswap32:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    bswapl %edi # sched: [2:0.50]
+; SKYLAKE-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_bswap32:
+; SKX:       # %bb.0:
+; SKX-NEXT:    bswapl %edi # sched: [2:0.50]
+; SKX-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_bswap32:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    bswapl %edi # sched: [1:0.50]
+; BTVER2-NEXT:    movl %edi, %eax # sched: [1:0.50]
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_bswap32:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    bswapl %edi # sched: [1:1.00]
+; ZNVER1-NEXT:    movl %edi, %eax # sched: [1:0.25]
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  %1 = tail call i32 asm "bswap $0", "=r,0"(i32 %a0) nounwind
+  ret i32 %1
+}
+define i64 @test_bswap64(i64 %a0) optsize {
+; GENERIC-LABEL: test_bswap64:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    bswapq %rdi # sched: [2:1.00]
+; GENERIC-NEXT:    movq %rdi, %rax # sched: [1:0.33]
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_bswap64:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    bswapq %rdi # sched: [1:1.00]
+; ATOM-NEXT:    movq %rdi, %rax # sched: [1:0.50]
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_bswap64:
+; SLM:       # %bb.0:
+; SLM-NEXT:    bswapq %rdi # sched: [1:0.50]
+; SLM-NEXT:    movq %rdi, %rax # sched: [1:0.50]
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_bswap64:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    bswapq %rdi # sched: [2:1.00]
+; SANDY-NEXT:    movq %rdi, %rax # sched: [1:0.33]
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_bswap64:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    bswapq %rdi # sched: [2:0.50]
+; HASWELL-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_bswap64:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    bswapq %rdi # sched: [2:0.50]
+; BROADWELL-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_bswap64:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    bswapq %rdi # sched: [2:0.50]
+; SKYLAKE-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_bswap64:
+; SKX:       # %bb.0:
+; SKX-NEXT:    bswapq %rdi # sched: [2:0.50]
+; SKX-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_bswap64:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    bswapq %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    movq %rdi, %rax # sched: [1:0.50]
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_bswap64:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    bswapq %rdi # sched: [1:1.00]
+; ZNVER1-NEXT:    movq %rdi, %rax # sched: [1:0.25]
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  %1 = tail call i64 asm "bswap $0", "=r,0"(i64 %a0) nounwind
+  ret i64 %1
+}
+
+define void @test_bt_btc_btr_bts_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
+; GENERIC-LABEL: test_bt_btc_btr_bts_16:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    btw %si, %di # sched: [1:0.50]
+; GENERIC-NEXT:    btcw %si, %di # sched: [1:0.50]
+; GENERIC-NEXT:    btrw %si, %di # sched: [1:0.50]
+; GENERIC-NEXT:    btsw %si, %di # sched: [1:0.50]
+; GENERIC-NEXT:    btw %si, (%rdx) # sched: [9:1.00]
+; GENERIC-NEXT:    btcw %si, (%rdx) # sched: [9:1.00]
+; GENERIC-NEXT:    btrw %si, (%rdx) # sched: [9:1.00]
+; GENERIC-NEXT:    btsw %si, (%rdx) # sched: [9:1.00]
+; GENERIC-NEXT:    btw $7, %di # sched: [1:0.50]
+; GENERIC-NEXT:    btcw $7, %di # sched: [1:0.50]
+; GENERIC-NEXT:    btrw $7, %di # sched: [1:0.50]
+; GENERIC-NEXT:    btsw $7, %di # sched: [1:0.50]
+; GENERIC-NEXT:    btw $7, (%rdx) # sched: [6:0.50]
+; GENERIC-NEXT:    btcw $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    btrw $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    btsw $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_bt_btc_btr_bts_16:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    btw %si, %di # sched: [1:1.00]
+; ATOM-NEXT:    btcw %si, %di # sched: [1:1.00]
+; ATOM-NEXT:    btrw %si, %di # sched: [1:1.00]
+; ATOM-NEXT:    btsw %si, %di # sched: [1:1.00]
+; ATOM-NEXT:    btw %si, (%rdx) # sched: [9:4.50]
+; ATOM-NEXT:    btcw %si, (%rdx) # sched: [11:5.50]
+; ATOM-NEXT:    btrw %si, (%rdx) # sched: [11:5.50]
+; ATOM-NEXT:    btsw %si, (%rdx) # sched: [11:5.50]
+; ATOM-NEXT:    btw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    btcw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    btrw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    btsw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    btw $7, (%rdx) # sched: [1:0.50]
+; ATOM-NEXT:    btcw $7, (%rdx) # sched: [2:1.00]
+; ATOM-NEXT:    btrw $7, (%rdx) # sched: [2:1.00]
+; ATOM-NEXT:    btsw $7, (%rdx) # sched: [2:1.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_bt_btc_btr_bts_16:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    btw %si, %di # sched: [1:0.50]
+; SLM-NEXT:    btcw %si, %di # sched: [1:0.50]
+; SLM-NEXT:    btrw %si, %di # sched: [1:0.50]
+; SLM-NEXT:    btsw %si, %di # sched: [1:0.50]
+; SLM-NEXT:    btw %si, (%rdx) # sched: [4:1.00]
+; SLM-NEXT:    btcw %si, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    btrw %si, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    btsw %si, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    btw $7, %di # sched: [1:0.50]
@@ -6038,5634 +6679,6916 @@ define void @test_not(i8 %a0, i16 %a1, i
   ret void
 }
 
-; TODO - test_or
-
-define void @test_out() optsize {
-; GENERIC-LABEL: test_out:
+define void @test_or_8(i8 %a0, i8* %a1) optsize {
+; GENERIC-LABEL: test_or_8:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    outb %al, $7 # sched: [4:1.33]
-; GENERIC-NEXT:    outw %ax, $7 # sched: [100:0.33]
-; GENERIC-NEXT:    outl %eax, $7 # sched: [4:1.33]
-; GENERIC-NEXT:    outb %al, %dx # sched: [3:1.00]
-; GENERIC-NEXT:    outw %ax, %dx # sched: [100:0.33]
-; GENERIC-NEXT:    outl %eax, %dx # sched: [3:1.00]
+; GENERIC-NEXT:    orb $7, %al # sched: [1:0.33]
+; GENERIC-NEXT:    orb $7, %dil # sched: [1:0.33]
+; GENERIC-NEXT:    orb $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    orb %dil, %dil # sched: [1:0.33]
+; GENERIC-NEXT:    orb %dil, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    orb (%rsi), %dil # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_out:
+; ATOM-LABEL: test_or_8:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    outb %al, $7 # sched: [72:36.00]
-; ATOM-NEXT:    outw %ax, $7 # sched: [72:36.00]
-; ATOM-NEXT:    outl %eax, $7 # sched: [72:36.00]
-; ATOM-NEXT:    outb %al, %dx # sched: [68:34.00]
-; ATOM-NEXT:    outw %ax, %dx # sched: [68:34.00]
-; ATOM-NEXT:    outl %eax, %dx # sched: [68:34.00]
+; ATOM-NEXT:    orb $7, %al # sched: [1:0.50]
+; ATOM-NEXT:    orb $7, %dil # sched: [1:0.50]
+; ATOM-NEXT:    orb $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    orb %dil, %dil # sched: [1:0.50]
+; ATOM-NEXT:    orb %dil, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    orb (%rsi), %dil # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_out:
+; SLM-LABEL: test_or_8:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    outb %al, $7 # sched: [100:1.00]
-; SLM-NEXT:    outw %ax, $7 # sched: [100:1.00]
-; SLM-NEXT:    outl %eax, $7 # sched: [100:1.00]
-; SLM-NEXT:    outb %al, %dx # sched: [100:1.00]
-; SLM-NEXT:    outw %ax, %dx # sched: [100:1.00]
-; SLM-NEXT:    outl %eax, %dx # sched: [100:1.00]
+; SLM-NEXT:    orb $7, %al # sched: [1:0.50]
+; SLM-NEXT:    orb $7, %dil # sched: [1:0.50]
+; SLM-NEXT:    orb $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    orb %dil, %dil # sched: [1:0.50]
+; SLM-NEXT:    orb %dil, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    orb (%rsi), %dil # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_out:
+; SANDY-LABEL: test_or_8:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    outb %al, $7 # sched: [4:1.33]
-; SANDY-NEXT:    outw %ax, $7 # sched: [100:0.33]
-; SANDY-NEXT:    outl %eax, $7 # sched: [4:1.33]
-; SANDY-NEXT:    outb %al, %dx # sched: [3:1.00]
-; SANDY-NEXT:    outw %ax, %dx # sched: [100:0.33]
-; SANDY-NEXT:    outl %eax, %dx # sched: [3:1.00]
+; SANDY-NEXT:    orb $7, %al # sched: [1:0.33]
+; SANDY-NEXT:    orb $7, %dil # sched: [1:0.33]
+; SANDY-NEXT:    orb $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    orb %dil, %dil # sched: [1:0.33]
+; SANDY-NEXT:    orb %dil, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    orb (%rsi), %dil # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_out:
+; HASWELL-LABEL: test_or_8:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    outb %al, $7 # sched: [36:5.00]
-; HASWELL-NEXT:    outw %ax, $7 # sched: [36:5.00]
-; HASWELL-NEXT:    outl %eax, $7 # sched: [36:5.00]
-; HASWELL-NEXT:    outb %al, %dx # sched: [36:5.00]
-; HASWELL-NEXT:    outw %ax, %dx # sched: [36:5.00]
-; HASWELL-NEXT:    outl %eax, %dx # sched: [36:5.00]
+; HASWELL-NEXT:    orb $7, %al # sched: [1:0.25]
+; HASWELL-NEXT:    orb $7, %dil # sched: [1:0.25]
+; HASWELL-NEXT:    orb $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    orb %dil, %dil # sched: [1:0.25]
+; HASWELL-NEXT:    orb %dil, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    orb (%rsi), %dil # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_out:
+; BROADWELL-LABEL: test_or_8:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    outb %al, $7 # sched: [35:5.00]
-; BROADWELL-NEXT:    outw %ax, $7 # sched: [35:5.00]
-; BROADWELL-NEXT:    outl %eax, $7 # sched: [35:5.00]
-; BROADWELL-NEXT:    outb %al, %dx # sched: [35:5.00]
-; BROADWELL-NEXT:    outw %ax, %dx # sched: [35:5.00]
-; BROADWELL-NEXT:    outl %eax, %dx # sched: [35:5.00]
+; BROADWELL-NEXT:    orb $7, %al # sched: [1:0.25]
+; BROADWELL-NEXT:    orb $7, %dil # sched: [1:0.25]
+; BROADWELL-NEXT:    orb $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    orb %dil, %dil # sched: [1:0.25]
+; BROADWELL-NEXT:    orb %dil, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    orb (%rsi), %dil # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_out:
+; SKYLAKE-LABEL: test_or_8:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    outb %al, $7 # sched: [35:5.00]
-; SKYLAKE-NEXT:    outw %ax, $7 # sched: [35:5.00]
-; SKYLAKE-NEXT:    outl %eax, $7 # sched: [35:5.00]
-; SKYLAKE-NEXT:    outb %al, %dx # sched: [35:5.00]
-; SKYLAKE-NEXT:    outw %ax, %dx # sched: [35:5.00]
-; SKYLAKE-NEXT:    outl %eax, %dx # sched: [35:5.00]
+; SKYLAKE-NEXT:    orb $7, %al # sched: [1:0.25]
+; SKYLAKE-NEXT:    orb $7, %dil # sched: [1:0.25]
+; SKYLAKE-NEXT:    orb $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    orb %dil, %dil # sched: [1:0.25]
+; SKYLAKE-NEXT:    orb %dil, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    orb (%rsi), %dil # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_out:
+; SKX-LABEL: test_or_8:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    outb %al, $7 # sched: [35:5.00]
-; SKX-NEXT:    outw %ax, $7 # sched: [35:5.00]
-; SKX-NEXT:    outl %eax, $7 # sched: [35:5.00]
-; SKX-NEXT:    outb %al, %dx # sched: [35:5.00]
-; SKX-NEXT:    outw %ax, %dx # sched: [35:5.00]
-; SKX-NEXT:    outl %eax, %dx # sched: [35:5.00]
+; SKX-NEXT:    orb $7, %al # sched: [1:0.25]
+; SKX-NEXT:    orb $7, %dil # sched: [1:0.25]
+; SKX-NEXT:    orb $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    orb %dil, %dil # sched: [1:0.25]
+; SKX-NEXT:    orb %dil, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    orb (%rsi), %dil # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_out:
+; BTVER2-LABEL: test_or_8:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    outb %al, $7 # sched: [100:0.17]
-; BTVER2-NEXT:    outw %ax, $7 # sched: [100:0.17]
-; BTVER2-NEXT:    outl %eax, $7 # sched: [100:0.17]
-; BTVER2-NEXT:    outb %al, %dx # sched: [100:0.17]
-; BTVER2-NEXT:    outw %ax, %dx # sched: [100:0.17]
-; BTVER2-NEXT:    outl %eax, %dx # sched: [100:0.17]
+; BTVER2-NEXT:    orb $7, %al # sched: [1:0.50]
+; BTVER2-NEXT:    orb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    orb $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    orb %dil, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    orb %dil, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    orb (%rsi), %dil # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_out:
+; ZNVER1-LABEL: test_or_8:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    outb %al, $7 # sched: [100:?]
-; ZNVER1-NEXT:    outw %ax, $7 # sched: [100:?]
-; ZNVER1-NEXT:    outl %eax, $7 # sched: [100:?]
-; ZNVER1-NEXT:    outb %al, %dx # sched: [100:?]
-; ZNVER1-NEXT:    outw %ax, %dx # sched: [100:?]
-; ZNVER1-NEXT:    outl %eax, %dx # sched: [100:?]
+; ZNVER1-NEXT:    orb $7, %al # sched: [1:0.25]
+; ZNVER1-NEXT:    orb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    orb $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    orb %dil, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    orb %dil, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    orb (%rsi), %dil # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "outb %AL, $0 \0A\09 outw %AX, $0 \0A\09 outl %EAX, $0 \0A\09 outb %AL, %DX \0A\09 outw %AX, %DX \0A\09 outl %EAX, %DX", "i"(i8 7) nounwind
+  tail call void asm "orb $2, %AL \0A\09 orb $2, $0 \0A\09 orb $2, $1 \0A\09 orb $0, $0 \0A\09 orb $0, $1 \0A\09 orb $1, $0", "r,*m,i"(i8 %a0, i8* %a1, i8 7) nounwind
   ret void
 }
-
-define void @test_outs() optsize {
-; GENERIC-LABEL: test_outs:
+define void @test_or_16(i16 %a0, i16* %a1) optsize {
+; GENERIC-LABEL: test_or_16:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    outsb (%rsi), %dx # sched: [100:0.33]
-; GENERIC-NEXT:    outsw (%rsi), %dx # sched: [100:0.33]
-; GENERIC-NEXT:    outsl (%rsi), %dx # sched: [100:0.33]
+; GENERIC-NEXT:    orw $511, %ax # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    orw $511, %di # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    orw $7, %di # sched: [1:0.33]
+; GENERIC-NEXT:    orw $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    orw %di, %di # sched: [1:0.33]
+; GENERIC-NEXT:    orw %di, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    orw (%rsi), %di # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_outs:
+; ATOM-LABEL: test_or_16:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    outsb (%rsi), %dx # sched: [74:37.00]
-; ATOM-NEXT:    outsw (%rsi), %dx # sched: [74:37.00]
-; ATOM-NEXT:    outsl (%rsi), %dx # sched: [74:37.00]
+; ATOM-NEXT:    orw $511, %ax # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    orw $511, %di # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    orw $7, %di # sched: [1:0.50]
+; ATOM-NEXT:    orw $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    orw %di, %di # sched: [1:0.50]
+; ATOM-NEXT:    orw %di, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    orw (%rsi), %di # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_outs:
+; SLM-LABEL: test_or_16:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    outsb (%rsi), %dx # sched: [100:1.00]
-; SLM-NEXT:    outsw (%rsi), %dx # sched: [100:1.00]
-; SLM-NEXT:    outsl (%rsi), %dx # sched: [100:1.00]
+; SLM-NEXT:    orw $511, %ax # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    orw $511, %di # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    orw $7, %di # sched: [1:0.50]
+; SLM-NEXT:    orw $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    orw %di, %di # sched: [1:0.50]
+; SLM-NEXT:    orw %di, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    orw (%rsi), %di # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_outs:
+; SANDY-LABEL: test_or_16:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    outsb (%rsi), %dx # sched: [100:0.33]
-; SANDY-NEXT:    outsw (%rsi), %dx # sched: [100:0.33]
-; SANDY-NEXT:    outsl (%rsi), %dx # sched: [100:0.33]
+; SANDY-NEXT:    orw $511, %ax # imm = 0x1FF
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    orw $511, %di # imm = 0x1FF
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    orw $7, %di # sched: [1:0.33]
+; SANDY-NEXT:    orw $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    orw %di, %di # sched: [1:0.33]
+; SANDY-NEXT:    orw %di, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    orw (%rsi), %di # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_outs:
+; HASWELL-LABEL: test_or_16:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    outsb (%rsi), %dx # sched: [100:0.25]
-; HASWELL-NEXT:    outsw (%rsi), %dx # sched: [100:0.25]
-; HASWELL-NEXT:    outsl (%rsi), %dx # sched: [100:0.25]
+; HASWELL-NEXT:    orw $511, %ax # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    orw $511, %di # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    orw $7, %di # sched: [1:0.25]
+; HASWELL-NEXT:    orw $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    orw %di, %di # sched: [1:0.25]
+; HASWELL-NEXT:    orw %di, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    orw (%rsi), %di # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_outs:
+; BROADWELL-LABEL: test_or_16:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    outsb (%rsi), %dx # sched: [100:0.25]
-; BROADWELL-NEXT:    outsw (%rsi), %dx # sched: [100:0.25]
-; BROADWELL-NEXT:    outsl (%rsi), %dx # sched: [100:0.25]
+; BROADWELL-NEXT:    orw $511, %ax # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    orw $511, %di # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    orw $7, %di # sched: [1:0.25]
+; BROADWELL-NEXT:    orw $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    orw %di, %di # sched: [1:0.25]
+; BROADWELL-NEXT:    orw %di, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    orw (%rsi), %di # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_outs:
+; SKYLAKE-LABEL: test_or_16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    outsb (%rsi), %dx # sched: [100:0.25]
-; SKYLAKE-NEXT:    outsw (%rsi), %dx # sched: [100:0.25]
-; SKYLAKE-NEXT:    outsl (%rsi), %dx # sched: [100:0.25]
+; SKYLAKE-NEXT:    orw $511, %ax # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    orw $511, %di # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    orw $7, %di # sched: [1:0.25]
+; SKYLAKE-NEXT:    orw $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    orw %di, %di # sched: [1:0.25]
+; SKYLAKE-NEXT:    orw %di, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    orw (%rsi), %di # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_outs:
+; SKX-LABEL: test_or_16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    outsb (%rsi), %dx # sched: [100:0.25]
-; SKX-NEXT:    outsw (%rsi), %dx # sched: [100:0.25]
-; SKX-NEXT:    outsl (%rsi), %dx # sched: [100:0.25]
+; SKX-NEXT:    orw $511, %ax # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    orw $511, %di # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    orw $7, %di # sched: [1:0.25]
+; SKX-NEXT:    orw $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    orw %di, %di # sched: [1:0.25]
+; SKX-NEXT:    orw %di, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    orw (%rsi), %di # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_outs:
+; BTVER2-LABEL: test_or_16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    outsb (%rsi), %dx # sched: [100:0.17]
-; BTVER2-NEXT:    outsw (%rsi), %dx # sched: [100:0.17]
-; BTVER2-NEXT:    outsl (%rsi), %dx # sched: [100:0.17]
+; BTVER2-NEXT:    orw $511, %ax # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    orw $511, %di # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    orw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    orw $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    orw %di, %di # sched: [1:0.50]
+; BTVER2-NEXT:    orw %di, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    orw (%rsi), %di # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_outs:
+; ZNVER1-LABEL: test_or_16:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    outsb (%rsi), %dx # sched: [100:?]
-; ZNVER1-NEXT:    outsw (%rsi), %dx # sched: [100:?]
-; ZNVER1-NEXT:    outsl (%rsi), %dx # sched: [100:?]
+; ZNVER1-NEXT:    orw $511, %ax # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    orw $511, %di # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    orw $511, (%rsi) # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    orw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    orw $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    orw %di, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    orw %di, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    orw (%rsi), %di # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "outsb \0A\09 outsw \0A\09 outsl", ""()
+  tail call void asm "orw $2, %AX \0A\09 orw $2, $0 \0A\09 orw $2, $1 \0A\09 orw $3, $0 \0A\09 orw $3, $1 \0A\09 orw $0, $0 \0A\09 orw $0, $1 \0A\09 orw $1, $0", "r,*m,i,i"(i16 %a0, i16* %a1, i16 511, i8 7) nounwind
   ret void
 }
-
-define void @test_pause() optsize {
-; GENERIC-LABEL: test_pause:
+define void @test_or_32(i32 %a0, i32* %a1) optsize {
+; GENERIC-LABEL: test_or_32:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    pause # sched: [4:1.33]
+; GENERIC-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    orl $7, %edi # sched: [1:0.33]
+; GENERIC-NEXT:    orl $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    orl %edi, %edi # sched: [1:0.33]
+; GENERIC-NEXT:    orl %edi, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    orl (%rsi), %edi # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_pause:
+; ATOM-LABEL: test_or_32:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    pause # sched: [17:8.50]
+; ATOM-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    orl $7, %edi # sched: [1:0.50]
+; ATOM-NEXT:    orl $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    orl %edi, %edi # sched: [1:0.50]
+; ATOM-NEXT:    orl %edi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    orl (%rsi), %edi # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_pause:
+; SLM-LABEL: test_or_32:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    pause # sched: [1:?]
+; SLM-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    orl $7, %edi # sched: [1:0.50]
+; SLM-NEXT:    orl $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    orl %edi, %edi # sched: [1:0.50]
+; SLM-NEXT:    orl %edi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    orl (%rsi), %edi # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_pause:
+; SANDY-LABEL: test_or_32:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    pause # sched: [4:1.33]
+; SANDY-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    orl $7, %edi # sched: [1:0.33]
+; SANDY-NEXT:    orl $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    orl %edi, %edi # sched: [1:0.33]
+; SANDY-NEXT:    orl %edi, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    orl (%rsi), %edi # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_pause:
+; HASWELL-LABEL: test_or_32:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    pause # sched: [5:1.25]
+; HASWELL-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    orl $7, %edi # sched: [1:0.25]
+; HASWELL-NEXT:    orl $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    orl %edi, %edi # sched: [1:0.25]
+; HASWELL-NEXT:    orl %edi, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    orl (%rsi), %edi # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_pause:
+; BROADWELL-LABEL: test_or_32:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    pause # sched: [5:1.25]
+; BROADWELL-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    orl $7, %edi # sched: [1:0.25]
+; BROADWELL-NEXT:    orl $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    orl %edi, %edi # sched: [1:0.25]
+; BROADWELL-NEXT:    orl %edi, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    orl (%rsi), %edi # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_pause:
+; SKYLAKE-LABEL: test_or_32:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    pause # sched: [4:1.00]
+; SKYLAKE-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    orl $7, %edi # sched: [1:0.25]
+; SKYLAKE-NEXT:    orl $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    orl %edi, %edi # sched: [1:0.25]
+; SKYLAKE-NEXT:    orl %edi, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    orl (%rsi), %edi # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_pause:
+; SKX-LABEL: test_or_32:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    pause # sched: [140:1.00]
+; SKX-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    orl $7, %edi # sched: [1:0.25]
+; SKX-NEXT:    orl $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    orl %edi, %edi # sched: [1:0.25]
+; SKX-NEXT:    orl %edi, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    orl (%rsi), %edi # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_pause:
+; BTVER2-LABEL: test_or_32:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    pause # sched: [1:?]
+; BTVER2-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    orl $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    orl $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    orl %edi, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    orl %edi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    orl (%rsi), %edi # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_pause:
+; ZNVER1-LABEL: test_or_32:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    pause # sched: [100:?]
+; ZNVER1-NEXT:    orl $665536, %eax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    orl $665536, %edi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    orl $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    orl $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    orl $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    orl %edi, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    orl %edi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    orl (%rsi), %edi # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "pause", ""()
+  tail call void asm "orl $2, %EAX \0A\09 orl $2, $0 \0A\09 orl $2, $1 \0A\09 orl $3, $0 \0A\09 orl $3, $1 \0A\09 orl $0, $0 \0A\09 orl $0, $1 \0A\09 orl $1, $0", "r,*m,i,i"(i32 %a0, i32* %a1, i32 665536, i8 7) nounwind
   ret void
 }
-
-; TODO - test_pop
-; TODO - test_popa
-; TODO - test_popf
-; TODO - test_popfd
-; TODO - test_popfq
-
-; TODO - test_prefetch
-; TODO - test_prefetchw
-; TODO - test_prefetchX
-
-; TODO - test_push
-; TODO - test_pusha
-; TODO - test_pushad
-; TODO - test_pushf
-; TODO - test_pushfd
-; TODO - test_pushfq
-
-define void @test_rcl_rcr_8(i8 %a0, i8 %a1, i8 *%a2) optsize {
-; GENERIC-LABEL: test_rcl_rcr_8:
+define void @test_or_64(i64 %a0, i64* %a1) optsize {
+; GENERIC-LABEL: test_or_64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    rclb %dil # sched: [1:0.50]
-; GENERIC-NEXT:    rcrb %dil # sched: [1:0.50]
-; GENERIC-NEXT:    rclb (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrb (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rclb $7, %dil # sched: [1:0.50]
-; GENERIC-NEXT:    rcrb $7, %dil # sched: [1:0.50]
-; GENERIC-NEXT:    rclb $7, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrb $7, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rclb %cl, %dil # sched: [1:0.50]
-; GENERIC-NEXT:    rcrb %cl, %dil # sched: [1:0.50]
-; GENERIC-NEXT:    rclb %cl, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrb %cl, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    orq $7, %rdi # sched: [1:0.33]
+; GENERIC-NEXT:    orq $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    orq %rdi, %rdi # sched: [1:0.33]
+; GENERIC-NEXT:    orq %rdi, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    orq (%rsi), %rdi # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_rcl_rcr_8:
+; ATOM-LABEL: test_or_64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    rclb %dil # sched: [1:1.00]
-; ATOM-NEXT:    rcrb %dil # sched: [1:1.00]
-; ATOM-NEXT:    rclb (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrb (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rclb $7, %dil # sched: [1:1.00]
-; ATOM-NEXT:    rcrb $7, %dil # sched: [1:1.00]
-; ATOM-NEXT:    rclb $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrb $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rclb %cl, %dil # sched: [1:1.00]
-; ATOM-NEXT:    rcrb %cl, %dil # sched: [1:1.00]
-; ATOM-NEXT:    rclb %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrb %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    orq $7, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    orq $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    orq %rdi, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    orq %rdi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    orq (%rsi), %rdi # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_rcl_rcr_8:
+; SLM-LABEL: test_or_64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    rclb %dil # sched: [1:1.00]
-; SLM-NEXT:    rcrb %dil # sched: [1:1.00]
-; SLM-NEXT:    rclb (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrb (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rclb $7, %dil # sched: [1:1.00]
-; SLM-NEXT:    rcrb $7, %dil # sched: [1:1.00]
-; SLM-NEXT:    rclb $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrb $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rclb %cl, %dil # sched: [1:1.00]
-; SLM-NEXT:    rcrb %cl, %dil # sched: [1:1.00]
-; SLM-NEXT:    rclb %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrb %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    orq $7, %rdi # sched: [1:0.50]
+; SLM-NEXT:    orq $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    orq %rdi, %rdi # sched: [1:0.50]
+; SLM-NEXT:    orq %rdi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    orq (%rsi), %rdi # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_rcl_rcr_8:
+; SANDY-LABEL: test_or_64:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    rclb %dil # sched: [1:0.50]
-; SANDY-NEXT:    rcrb %dil # sched: [1:0.50]
-; SANDY-NEXT:    rclb (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrb (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rclb $7, %dil # sched: [1:0.50]
-; SANDY-NEXT:    rcrb $7, %dil # sched: [1:0.50]
-; SANDY-NEXT:    rclb $7, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrb $7, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rclb %cl, %dil # sched: [1:0.50]
-; SANDY-NEXT:    rcrb %cl, %dil # sched: [1:0.50]
-; SANDY-NEXT:    rclb %cl, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrb %cl, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    orq $7, %rdi # sched: [1:0.33]
+; SANDY-NEXT:    orq $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    orq %rdi, %rdi # sched: [1:0.33]
+; SANDY-NEXT:    orq %rdi, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    orq (%rsi), %rdi # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_rcl_rcr_8:
+; HASWELL-LABEL: test_or_64:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    rclb %dil # sched: [3:0.75]
-; HASWELL-NEXT:    rcrb %dil # sched: [3:0.75]
-; HASWELL-NEXT:    rclb (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcrb (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rclb $7, %dil # sched: [3:0.75]
-; HASWELL-NEXT:    rcrb $7, %dil # sched: [3:0.75]
-; HASWELL-NEXT:    rclb $7, (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcrb $7, (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rclb %cl, %dil # sched: [11:2.25]
-; HASWELL-NEXT:    rcrb %cl, %dil # sched: [14:2.50]
-; HASWELL-NEXT:    rclb %cl, (%rdx) # sched: [16:2.00]
-; HASWELL-NEXT:    rcrb %cl, (%rdx) # sched: [19:2.25]
+; HASWELL-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    orq $7, %rdi # sched: [1:0.25]
+; HASWELL-NEXT:    orq $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    orq %rdi, %rdi # sched: [1:0.25]
+; HASWELL-NEXT:    orq %rdi, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    orq (%rsi), %rdi # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_rcl_rcr_8:
+; BROADWELL-LABEL: test_or_64:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    rclb %dil # sched: [3:0.75]
-; BROADWELL-NEXT:    rcrb %dil # sched: [3:0.75]
-; BROADWELL-NEXT:    rclb (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcrb (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rclb $7, %dil # sched: [3:0.75]
-; BROADWELL-NEXT:    rcrb $7, %dil # sched: [3:0.75]
-; BROADWELL-NEXT:    rclb $7, (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcrb $7, (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rclb %cl, %dil # sched: [11:2.25]
-; BROADWELL-NEXT:    rcrb %cl, %dil # sched: [14:2.50]
-; BROADWELL-NEXT:    rclb %cl, (%rdx) # sched: [15:2.00]
-; BROADWELL-NEXT:    rcrb %cl, (%rdx) # sched: [18:2.25]
+; BROADWELL-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    orq $7, %rdi # sched: [1:0.25]
+; BROADWELL-NEXT:    orq $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    orq %rdi, %rdi # sched: [1:0.25]
+; BROADWELL-NEXT:    orq %rdi, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    orq (%rsi), %rdi # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_rcl_rcr_8:
+; SKYLAKE-LABEL: test_or_64:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    rclb %dil # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcrb %dil # sched: [3:0.75]
-; SKYLAKE-NEXT:    rclb (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcrb (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rclb $7, %dil # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcrb $7, %dil # sched: [3:0.75]
-; SKYLAKE-NEXT:    rclb $7, (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcrb $7, (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rclb %cl, %dil # sched: [11:2.50]
-; SKYLAKE-NEXT:    rcrb %cl, %dil # sched: [14:2.50]
-; SKYLAKE-NEXT:    rclb %cl, (%rdx) # sched: [15:2.50]
-; SKYLAKE-NEXT:    rcrb %cl, (%rdx) # sched: [18:2.25]
+; SKYLAKE-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    orq $7, %rdi # sched: [1:0.25]
+; SKYLAKE-NEXT:    orq $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    orq %rdi, %rdi # sched: [1:0.25]
+; SKYLAKE-NEXT:    orq %rdi, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    orq (%rsi), %rdi # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_rcl_rcr_8:
+; SKX-LABEL: test_or_64:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    rclb %dil # sched: [3:0.75]
-; SKX-NEXT:    rcrb %dil # sched: [3:0.75]
-; SKX-NEXT:    rclb (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcrb (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rclb $7, %dil # sched: [3:0.75]
-; SKX-NEXT:    rcrb $7, %dil # sched: [3:0.75]
-; SKX-NEXT:    rclb $7, (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcrb $7, (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rclb %cl, %dil # sched: [11:2.50]
-; SKX-NEXT:    rcrb %cl, %dil # sched: [14:2.50]
-; SKX-NEXT:    rclb %cl, (%rdx) # sched: [15:2.50]
-; SKX-NEXT:    rcrb %cl, (%rdx) # sched: [18:2.25]
+; SKX-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    orq $7, %rdi # sched: [1:0.25]
+; SKX-NEXT:    orq $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    orq %rdi, %rdi # sched: [1:0.25]
+; SKX-NEXT:    orq %rdi, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    orq (%rsi), %rdi # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_rcl_rcr_8:
+; BTVER2-LABEL: test_or_64:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    rclb %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rcrb %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rclb (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrb (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rclb $7, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rcrb $7, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rclb $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrb $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rclb %cl, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rcrb %cl, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rclb %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrb %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    orq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    orq $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    orq %rdi, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    orq %rdi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    orq (%rsi), %rdi # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_rcl_rcr_8:
+; ZNVER1-LABEL: test_or_64:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    rclb %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrb %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rclb (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrb (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rclb $7, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrb $7, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rclb $7, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrb $7, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rclb %cl, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrb %cl, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rclb %cl, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrb %cl, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    orq $665536, %rax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    orq $665536, %rdi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    orq $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    orq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    orq $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    orq %rdi, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    orq %rdi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    orq (%rsi), %rdi # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "rclb $0 \0A\09 rcrb $0 \0A\09 rclb $2 \0A\09 rcrb $2 \0A\09 rclb $3, $0 \0A\09 rcrb $3, $0 \0A\09 rclb $3, $2 \0A\09 rcrb $3, $2 \0A\09 rclb %CL, $0 \0A\09 rcrb %CL, $0 \0A\09 rclb %CL, $2 \0A\09 rcrb %CL, $2", "r,r,*m,i"(i8 %a0, i8 %a1, i8 *%a2, i8 7)
+  tail call void asm "orq $2, %RAX \0A\09 orq $2, $0 \0A\09 orq $2, $1 \0A\09 orq $3, $0 \0A\09 orq $3, $1 \0A\09 orq $0, $0 \0A\09 orq $0, $1 \0A\09 orq $1, $0", "r,*m,i,i"(i64 %a0, i64* %a1, i32 665536, i8 7) nounwind
   ret void
 }
-define void @test_rcl_rcr_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
-; GENERIC-LABEL: test_rcl_rcr_16:
+
+define void @test_out() optsize {
+; GENERIC-LABEL: test_out:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    rclw %di # sched: [1:0.50]
-; GENERIC-NEXT:    rcrw %di # sched: [1:0.50]
-; GENERIC-NEXT:    rclw (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrw (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rclw $7, %di # sched: [1:0.50]
-; GENERIC-NEXT:    rcrw $7, %di # sched: [1:0.50]
-; GENERIC-NEXT:    rclw $7, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrw $7, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rclw %cl, %di # sched: [1:0.50]
-; GENERIC-NEXT:    rcrw %cl, %di # sched: [1:0.50]
-; GENERIC-NEXT:    rclw %cl, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrw %cl, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    outb %al, $7 # sched: [4:1.33]
+; GENERIC-NEXT:    outw %ax, $7 # sched: [100:0.33]
+; GENERIC-NEXT:    outl %eax, $7 # sched: [4:1.33]
+; GENERIC-NEXT:    outb %al, %dx # sched: [3:1.00]
+; GENERIC-NEXT:    outw %ax, %dx # sched: [100:0.33]
+; GENERIC-NEXT:    outl %eax, %dx # sched: [3:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_rcl_rcr_16:
+; ATOM-LABEL: test_out:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    rclw %di # sched: [1:1.00]
-; ATOM-NEXT:    rcrw %di # sched: [1:1.00]
-; ATOM-NEXT:    rclw (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrw (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rclw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    rcrw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    rclw $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrw $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rclw %cl, %di # sched: [1:1.00]
-; ATOM-NEXT:    rcrw %cl, %di # sched: [1:1.00]
-; ATOM-NEXT:    rclw %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrw %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    outb %al, $7 # sched: [72:36.00]
+; ATOM-NEXT:    outw %ax, $7 # sched: [72:36.00]
+; ATOM-NEXT:    outl %eax, $7 # sched: [72:36.00]
+; ATOM-NEXT:    outb %al, %dx # sched: [68:34.00]
+; ATOM-NEXT:    outw %ax, %dx # sched: [68:34.00]
+; ATOM-NEXT:    outl %eax, %dx # sched: [68:34.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_rcl_rcr_16:
+; SLM-LABEL: test_out:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    rclw %di # sched: [1:1.00]
-; SLM-NEXT:    rcrw %di # sched: [1:1.00]
-; SLM-NEXT:    rclw (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrw (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rclw $7, %di # sched: [1:1.00]
-; SLM-NEXT:    rcrw $7, %di # sched: [1:1.00]
-; SLM-NEXT:    rclw $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrw $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rclw %cl, %di # sched: [1:1.00]
-; SLM-NEXT:    rcrw %cl, %di # sched: [1:1.00]
-; SLM-NEXT:    rclw %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrw %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    outb %al, $7 # sched: [100:1.00]
+; SLM-NEXT:    outw %ax, $7 # sched: [100:1.00]
+; SLM-NEXT:    outl %eax, $7 # sched: [100:1.00]
+; SLM-NEXT:    outb %al, %dx # sched: [100:1.00]
+; SLM-NEXT:    outw %ax, %dx # sched: [100:1.00]
+; SLM-NEXT:    outl %eax, %dx # sched: [100:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_rcl_rcr_16:
+; SANDY-LABEL: test_out:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    rclw %di # sched: [1:0.50]
-; SANDY-NEXT:    rcrw %di # sched: [1:0.50]
-; SANDY-NEXT:    rclw (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrw (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rclw $7, %di # sched: [1:0.50]
-; SANDY-NEXT:    rcrw $7, %di # sched: [1:0.50]
-; SANDY-NEXT:    rclw $7, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrw $7, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rclw %cl, %di # sched: [1:0.50]
-; SANDY-NEXT:    rcrw %cl, %di # sched: [1:0.50]
-; SANDY-NEXT:    rclw %cl, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrw %cl, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    outb %al, $7 # sched: [4:1.33]
+; SANDY-NEXT:    outw %ax, $7 # sched: [100:0.33]
+; SANDY-NEXT:    outl %eax, $7 # sched: [4:1.33]
+; SANDY-NEXT:    outb %al, %dx # sched: [3:1.00]
+; SANDY-NEXT:    outw %ax, %dx # sched: [100:0.33]
+; SANDY-NEXT:    outl %eax, %dx # sched: [3:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_rcl_rcr_16:
+; HASWELL-LABEL: test_out:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    rclw %di # sched: [3:0.75]
-; HASWELL-NEXT:    rcrw %di # sched: [3:0.75]
-; HASWELL-NEXT:    rclw (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcrw (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rclw $7, %di # sched: [3:0.75]
-; HASWELL-NEXT:    rcrw $7, %di # sched: [3:0.75]
-; HASWELL-NEXT:    rclw $7, (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcrw $7, (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rclw %cl, %di # sched: [11:2.00]
-; HASWELL-NEXT:    rcrw %cl, %di # sched: [11:2.00]
-; HASWELL-NEXT:    rclw %cl, (%rdx) # sched: [16:2.00]
-; HASWELL-NEXT:    rcrw %cl, (%rdx) # sched: [19:2.25]
+; HASWELL-NEXT:    outb %al, $7 # sched: [36:5.00]
+; HASWELL-NEXT:    outw %ax, $7 # sched: [36:5.00]
+; HASWELL-NEXT:    outl %eax, $7 # sched: [36:5.00]
+; HASWELL-NEXT:    outb %al, %dx # sched: [36:5.00]
+; HASWELL-NEXT:    outw %ax, %dx # sched: [36:5.00]
+; HASWELL-NEXT:    outl %eax, %dx # sched: [36:5.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_rcl_rcr_16:
+; BROADWELL-LABEL: test_out:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    rclw %di # sched: [3:0.75]
-; BROADWELL-NEXT:    rcrw %di # sched: [3:0.75]
-; BROADWELL-NEXT:    rclw (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcrw (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rclw $7, %di # sched: [3:0.75]
-; BROADWELL-NEXT:    rcrw $7, %di # sched: [3:0.75]
-; BROADWELL-NEXT:    rclw $7, (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcrw $7, (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rclw %cl, %di # sched: [11:2.00]
-; BROADWELL-NEXT:    rcrw %cl, %di # sched: [11:2.00]
-; BROADWELL-NEXT:    rclw %cl, (%rdx) # sched: [15:2.00]
-; BROADWELL-NEXT:    rcrw %cl, (%rdx) # sched: [18:2.25]
+; BROADWELL-NEXT:    outb %al, $7 # sched: [35:5.00]
+; BROADWELL-NEXT:    outw %ax, $7 # sched: [35:5.00]
+; BROADWELL-NEXT:    outl %eax, $7 # sched: [35:5.00]
+; BROADWELL-NEXT:    outb %al, %dx # sched: [35:5.00]
+; BROADWELL-NEXT:    outw %ax, %dx # sched: [35:5.00]
+; BROADWELL-NEXT:    outl %eax, %dx # sched: [35:5.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_rcl_rcr_16:
+; SKYLAKE-LABEL: test_out:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    rclw %di # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcrw %di # sched: [3:0.75]
-; SKYLAKE-NEXT:    rclw (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcrw (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rclw $7, %di # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcrw $7, %di # sched: [3:0.75]
-; SKYLAKE-NEXT:    rclw $7, (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcrw $7, (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rclw %cl, %di # sched: [11:2.00]
-; SKYLAKE-NEXT:    rcrw %cl, %di # sched: [11:2.00]
-; SKYLAKE-NEXT:    rclw %cl, (%rdx) # sched: [15:2.50]
-; SKYLAKE-NEXT:    rcrw %cl, (%rdx) # sched: [18:2.25]
+; SKYLAKE-NEXT:    outb %al, $7 # sched: [35:5.00]
+; SKYLAKE-NEXT:    outw %ax, $7 # sched: [35:5.00]
+; SKYLAKE-NEXT:    outl %eax, $7 # sched: [35:5.00]
+; SKYLAKE-NEXT:    outb %al, %dx # sched: [35:5.00]
+; SKYLAKE-NEXT:    outw %ax, %dx # sched: [35:5.00]
+; SKYLAKE-NEXT:    outl %eax, %dx # sched: [35:5.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_rcl_rcr_16:
+; SKX-LABEL: test_out:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    rclw %di # sched: [3:0.75]
-; SKX-NEXT:    rcrw %di # sched: [3:0.75]
-; SKX-NEXT:    rclw (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcrw (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rclw $7, %di # sched: [3:0.75]
-; SKX-NEXT:    rcrw $7, %di # sched: [3:0.75]
-; SKX-NEXT:    rclw $7, (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcrw $7, (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rclw %cl, %di # sched: [11:2.00]
-; SKX-NEXT:    rcrw %cl, %di # sched: [11:2.00]
-; SKX-NEXT:    rclw %cl, (%rdx) # sched: [15:2.50]
-; SKX-NEXT:    rcrw %cl, (%rdx) # sched: [18:2.25]
+; SKX-NEXT:    outb %al, $7 # sched: [35:5.00]
+; SKX-NEXT:    outw %ax, $7 # sched: [35:5.00]
+; SKX-NEXT:    outl %eax, $7 # sched: [35:5.00]
+; SKX-NEXT:    outb %al, %dx # sched: [35:5.00]
+; SKX-NEXT:    outw %ax, %dx # sched: [35:5.00]
+; SKX-NEXT:    outl %eax, %dx # sched: [35:5.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_rcl_rcr_16:
+; BTVER2-LABEL: test_out:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    rclw %di # sched: [1:0.50]
-; BTVER2-NEXT:    rcrw %di # sched: [1:0.50]
-; BTVER2-NEXT:    rclw (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrw (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rclw $7, %di # sched: [1:0.50]
-; BTVER2-NEXT:    rcrw $7, %di # sched: [1:0.50]
-; BTVER2-NEXT:    rclw $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrw $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rclw %cl, %di # sched: [1:0.50]
-; BTVER2-NEXT:    rcrw %cl, %di # sched: [1:0.50]
-; BTVER2-NEXT:    rclw %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrw %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    outb %al, $7 # sched: [100:0.17]
+; BTVER2-NEXT:    outw %ax, $7 # sched: [100:0.17]
+; BTVER2-NEXT:    outl %eax, $7 # sched: [100:0.17]
+; BTVER2-NEXT:    outb %al, %dx # sched: [100:0.17]
+; BTVER2-NEXT:    outw %ax, %dx # sched: [100:0.17]
+; BTVER2-NEXT:    outl %eax, %dx # sched: [100:0.17]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_rcl_rcr_16:
+; ZNVER1-LABEL: test_out:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    rclw %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrw %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rclw (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrw (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rclw $7, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrw $7, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rclw $7, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrw $7, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rclw %cl, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrw %cl, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rclw %cl, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrw %cl, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    outb %al, $7 # sched: [100:?]
+; ZNVER1-NEXT:    outw %ax, $7 # sched: [100:?]
+; ZNVER1-NEXT:    outl %eax, $7 # sched: [100:?]
+; ZNVER1-NEXT:    outb %al, %dx # sched: [100:?]
+; ZNVER1-NEXT:    outw %ax, %dx # sched: [100:?]
+; ZNVER1-NEXT:    outl %eax, %dx # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "rclw $0 \0A\09 rcrw $0 \0A\09 rclw $2 \0A\09 rcrw $2 \0A\09 rclw $3, $0 \0A\09 rcrw $3, $0 \0A\09 rclw $3, $2 \0A\09 rcrw $3, $2 \0A\09 rclw %CL, $0 \0A\09 rcrw %CL, $0 \0A\09 rclw %CL, $2 \0A\09 rcrw %CL, $2", "r,r,*m,i"(i16 %a0, i16 %a1, i16 *%a2, i8 7)
+  tail call void asm "outb %AL, $0 \0A\09 outw %AX, $0 \0A\09 outl %EAX, $0 \0A\09 outb %AL, %DX \0A\09 outw %AX, %DX \0A\09 outl %EAX, %DX", "i"(i8 7) nounwind
   ret void
 }
-define void @test_rcl_rcr_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
-; GENERIC-LABEL: test_rcl_rcr_32:
+
+define void @test_outs() optsize {
+; GENERIC-LABEL: test_outs:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    rcll %edi # sched: [1:0.50]
-; GENERIC-NEXT:    rcrl %edi # sched: [1:0.50]
-; GENERIC-NEXT:    rcll (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrl (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcll $7, %edi # sched: [1:0.50]
-; GENERIC-NEXT:    rcrl $7, %edi # sched: [1:0.50]
-; GENERIC-NEXT:    rcll $7, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrl $7, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcll %cl, %edi # sched: [1:0.50]
-; GENERIC-NEXT:    rcrl %cl, %edi # sched: [1:0.50]
-; GENERIC-NEXT:    rcll %cl, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrl %cl, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    outsb (%rsi), %dx # sched: [100:0.33]
+; GENERIC-NEXT:    outsw (%rsi), %dx # sched: [100:0.33]
+; GENERIC-NEXT:    outsl (%rsi), %dx # sched: [100:0.33]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_rcl_rcr_32:
+; ATOM-LABEL: test_outs:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    rcll %edi # sched: [1:1.00]
-; ATOM-NEXT:    rcrl %edi # sched: [1:1.00]
-; ATOM-NEXT:    rcll (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrl (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcll $7, %edi # sched: [1:1.00]
-; ATOM-NEXT:    rcrl $7, %edi # sched: [1:1.00]
-; ATOM-NEXT:    rcll $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrl $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcll %cl, %edi # sched: [1:1.00]
-; ATOM-NEXT:    rcrl %cl, %edi # sched: [1:1.00]
-; ATOM-NEXT:    rcll %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrl %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    outsb (%rsi), %dx # sched: [74:37.00]
+; ATOM-NEXT:    outsw (%rsi), %dx # sched: [74:37.00]
+; ATOM-NEXT:    outsl (%rsi), %dx # sched: [74:37.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_rcl_rcr_32:
+; SLM-LABEL: test_outs:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    rcll %edi # sched: [1:1.00]
-; SLM-NEXT:    rcrl %edi # sched: [1:1.00]
-; SLM-NEXT:    rcll (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrl (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcll $7, %edi # sched: [1:1.00]
-; SLM-NEXT:    rcrl $7, %edi # sched: [1:1.00]
-; SLM-NEXT:    rcll $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrl $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcll %cl, %edi # sched: [1:1.00]
-; SLM-NEXT:    rcrl %cl, %edi # sched: [1:1.00]
-; SLM-NEXT:    rcll %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrl %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    outsb (%rsi), %dx # sched: [100:1.00]
+; SLM-NEXT:    outsw (%rsi), %dx # sched: [100:1.00]
+; SLM-NEXT:    outsl (%rsi), %dx # sched: [100:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_rcl_rcr_32:
+; SANDY-LABEL: test_outs:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    rcll %edi # sched: [1:0.50]
-; SANDY-NEXT:    rcrl %edi # sched: [1:0.50]
-; SANDY-NEXT:    rcll (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrl (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcll $7, %edi # sched: [1:0.50]
-; SANDY-NEXT:    rcrl $7, %edi # sched: [1:0.50]
-; SANDY-NEXT:    rcll $7, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrl $7, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcll %cl, %edi # sched: [1:0.50]
-; SANDY-NEXT:    rcrl %cl, %edi # sched: [1:0.50]
-; SANDY-NEXT:    rcll %cl, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrl %cl, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    outsb (%rsi), %dx # sched: [100:0.33]
+; SANDY-NEXT:    outsw (%rsi), %dx # sched: [100:0.33]
+; SANDY-NEXT:    outsl (%rsi), %dx # sched: [100:0.33]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_rcl_rcr_32:
+; HASWELL-LABEL: test_outs:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    rcll %edi # sched: [3:0.75]
-; HASWELL-NEXT:    rcrl %edi # sched: [3:0.75]
-; HASWELL-NEXT:    rcll (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcrl (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcll $7, %edi # sched: [3:0.75]
-; HASWELL-NEXT:    rcrl $7, %edi # sched: [3:0.75]
-; HASWELL-NEXT:    rcll $7, (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcrl $7, (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcll %cl, %edi # sched: [11:2.00]
-; HASWELL-NEXT:    rcrl %cl, %edi # sched: [11:2.00]
-; HASWELL-NEXT:    rcll %cl, (%rdx) # sched: [16:2.00]
-; HASWELL-NEXT:    rcrl %cl, (%rdx) # sched: [19:2.25]
+; HASWELL-NEXT:    outsb (%rsi), %dx # sched: [100:0.25]
+; HASWELL-NEXT:    outsw (%rsi), %dx # sched: [100:0.25]
+; HASWELL-NEXT:    outsl (%rsi), %dx # sched: [100:0.25]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_rcl_rcr_32:
+; BROADWELL-LABEL: test_outs:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    rcll %edi # sched: [3:0.75]
-; BROADWELL-NEXT:    rcrl %edi # sched: [3:0.75]
-; BROADWELL-NEXT:    rcll (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcrl (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcll $7, %edi # sched: [3:0.75]
-; BROADWELL-NEXT:    rcrl $7, %edi # sched: [3:0.75]
-; BROADWELL-NEXT:    rcll $7, (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcrl $7, (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcll %cl, %edi # sched: [11:2.00]
-; BROADWELL-NEXT:    rcrl %cl, %edi # sched: [11:2.00]
-; BROADWELL-NEXT:    rcll %cl, (%rdx) # sched: [15:2.00]
-; BROADWELL-NEXT:    rcrl %cl, (%rdx) # sched: [18:2.25]
+; BROADWELL-NEXT:    outsb (%rsi), %dx # sched: [100:0.25]
+; BROADWELL-NEXT:    outsw (%rsi), %dx # sched: [100:0.25]
+; BROADWELL-NEXT:    outsl (%rsi), %dx # sched: [100:0.25]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_rcl_rcr_32:
+; SKYLAKE-LABEL: test_outs:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    rcll %edi # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcrl %edi # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcll (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcrl (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcll $7, %edi # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcrl $7, %edi # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcll $7, (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcrl $7, (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcll %cl, %edi # sched: [11:2.00]
-; SKYLAKE-NEXT:    rcrl %cl, %edi # sched: [11:2.00]
-; SKYLAKE-NEXT:    rcll %cl, (%rdx) # sched: [15:2.50]
-; SKYLAKE-NEXT:    rcrl %cl, (%rdx) # sched: [18:2.25]
+; SKYLAKE-NEXT:    outsb (%rsi), %dx # sched: [100:0.25]
+; SKYLAKE-NEXT:    outsw (%rsi), %dx # sched: [100:0.25]
+; SKYLAKE-NEXT:    outsl (%rsi), %dx # sched: [100:0.25]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_rcl_rcr_32:
+; SKX-LABEL: test_outs:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    rcll %edi # sched: [3:0.75]
-; SKX-NEXT:    rcrl %edi # sched: [3:0.75]
-; SKX-NEXT:    rcll (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcrl (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcll $7, %edi # sched: [3:0.75]
-; SKX-NEXT:    rcrl $7, %edi # sched: [3:0.75]
-; SKX-NEXT:    rcll $7, (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcrl $7, (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcll %cl, %edi # sched: [11:2.00]
-; SKX-NEXT:    rcrl %cl, %edi # sched: [11:2.00]
-; SKX-NEXT:    rcll %cl, (%rdx) # sched: [15:2.50]
-; SKX-NEXT:    rcrl %cl, (%rdx) # sched: [18:2.25]
+; SKX-NEXT:    outsb (%rsi), %dx # sched: [100:0.25]
+; SKX-NEXT:    outsw (%rsi), %dx # sched: [100:0.25]
+; SKX-NEXT:    outsl (%rsi), %dx # sched: [100:0.25]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_rcl_rcr_32:
+; BTVER2-LABEL: test_outs:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    rcll %edi # sched: [1:0.50]
-; BTVER2-NEXT:    rcrl %edi # sched: [1:0.50]
-; BTVER2-NEXT:    rcll (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrl (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcll $7, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    rcrl $7, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    rcll $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrl $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcll %cl, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    rcrl %cl, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    rcll %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrl %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    outsb (%rsi), %dx # sched: [100:0.17]
+; BTVER2-NEXT:    outsw (%rsi), %dx # sched: [100:0.17]
+; BTVER2-NEXT:    outsl (%rsi), %dx # sched: [100:0.17]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_rcl_rcr_32:
+; ZNVER1-LABEL: test_outs:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    rcll %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrl %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    rcll (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrl (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcll $7, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrl $7, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    rcll $7, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrl $7, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcll %cl, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrl %cl, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    rcll %cl, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrl %cl, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    outsb (%rsi), %dx # sched: [100:?]
+; ZNVER1-NEXT:    outsw (%rsi), %dx # sched: [100:?]
+; ZNVER1-NEXT:    outsl (%rsi), %dx # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "rcll $0 \0A\09 rcrl $0 \0A\09 rcll $2 \0A\09 rcrl $2 \0A\09 rcll $3, $0 \0A\09 rcrl $3, $0 \0A\09 rcll $3, $2 \0A\09 rcrl $3, $2 \0A\09 rcll %CL, $0 \0A\09 rcrl %CL, $0 \0A\09 rcll %CL, $2 \0A\09 rcrl %CL, $2", "r,r,*m,i"(i32 %a0, i32 %a1, i32 *%a2, i8 7)
+  call void asm sideeffect "outsb \0A\09 outsw \0A\09 outsl", ""()
   ret void
 }
-define void @test_rcl_rcr_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
-; GENERIC-LABEL: test_rcl_rcr_64:
+
+define void @test_pause() optsize {
+; GENERIC-LABEL: test_pause:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    rclq %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    rcrq %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    rclq (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrq (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rclq $7, %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    rcrq $7, %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    rclq $7, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrq $7, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rclq %cl, %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    rcrq %cl, %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    rclq %cl, (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rcrq %cl, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    pause # sched: [4:1.33]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_rcl_rcr_64:
+; ATOM-LABEL: test_pause:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    rclq %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rcrq %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rclq (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrq (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rclq $7, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rcrq $7, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rclq $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrq $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rclq %cl, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rcrq %cl, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rclq %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rcrq %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    pause # sched: [17:8.50]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_rcl_rcr_64:
+; SLM-LABEL: test_pause:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    rclq %rdi # sched: [1:1.00]
-; SLM-NEXT:    rcrq %rdi # sched: [1:1.00]
-; SLM-NEXT:    rclq (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrq (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rclq $7, %rdi # sched: [1:1.00]
-; SLM-NEXT:    rcrq $7, %rdi # sched: [1:1.00]
-; SLM-NEXT:    rclq $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrq $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rclq %cl, %rdi # sched: [1:1.00]
-; SLM-NEXT:    rcrq %cl, %rdi # sched: [1:1.00]
-; SLM-NEXT:    rclq %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rcrq %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    pause # sched: [1:?]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_rcl_rcr_64:
+; SANDY-LABEL: test_pause:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    rclq %rdi # sched: [1:0.50]
-; SANDY-NEXT:    rcrq %rdi # sched: [1:0.50]
-; SANDY-NEXT:    rclq (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrq (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rclq $7, %rdi # sched: [1:0.50]
-; SANDY-NEXT:    rcrq $7, %rdi # sched: [1:0.50]
-; SANDY-NEXT:    rclq $7, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrq $7, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rclq %cl, %rdi # sched: [1:0.50]
-; SANDY-NEXT:    rcrq %cl, %rdi # sched: [1:0.50]
-; SANDY-NEXT:    rclq %cl, (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rcrq %cl, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    pause # sched: [4:1.33]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_rcl_rcr_64:
+; HASWELL-LABEL: test_pause:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    rclq %rdi # sched: [3:0.75]
-; HASWELL-NEXT:    rcrq %rdi # sched: [3:0.75]
-; HASWELL-NEXT:    rclq (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcrq (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rclq $7, %rdi # sched: [3:0.75]
-; HASWELL-NEXT:    rcrq $7, %rdi # sched: [3:0.75]
-; HASWELL-NEXT:    rclq $7, (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rcrq $7, (%rdx) # sched: [9:0.75]
-; HASWELL-NEXT:    rclq %cl, %rdi # sched: [11:2.00]
-; HASWELL-NEXT:    rcrq %cl, %rdi # sched: [11:2.00]
-; HASWELL-NEXT:    rclq %cl, (%rdx) # sched: [16:2.00]
-; HASWELL-NEXT:    rcrq %cl, (%rdx) # sched: [19:2.25]
+; HASWELL-NEXT:    pause # sched: [5:1.25]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_rcl_rcr_64:
+; BROADWELL-LABEL: test_pause:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    rclq %rdi # sched: [3:0.75]
-; BROADWELL-NEXT:    rcrq %rdi # sched: [3:0.75]
-; BROADWELL-NEXT:    rclq (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcrq (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rclq $7, %rdi # sched: [3:0.75]
-; BROADWELL-NEXT:    rcrq $7, %rdi # sched: [3:0.75]
-; BROADWELL-NEXT:    rclq $7, (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rcrq $7, (%rdx) # sched: [8:0.75]
-; BROADWELL-NEXT:    rclq %cl, %rdi # sched: [11:2.00]
-; BROADWELL-NEXT:    rcrq %cl, %rdi # sched: [11:2.00]
-; BROADWELL-NEXT:    rclq %cl, (%rdx) # sched: [15:2.00]
-; BROADWELL-NEXT:    rcrq %cl, (%rdx) # sched: [18:2.25]
+; BROADWELL-NEXT:    pause # sched: [5:1.25]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_rcl_rcr_64:
+; SKYLAKE-LABEL: test_pause:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    rclq %rdi # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcrq %rdi # sched: [3:0.75]
-; SKYLAKE-NEXT:    rclq (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcrq (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rclq $7, %rdi # sched: [3:0.75]
-; SKYLAKE-NEXT:    rcrq $7, %rdi # sched: [3:0.75]
-; SKYLAKE-NEXT:    rclq $7, (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rcrq $7, (%rdx) # sched: [8:0.75]
-; SKYLAKE-NEXT:    rclq %cl, %rdi # sched: [11:2.00]
-; SKYLAKE-NEXT:    rcrq %cl, %rdi # sched: [11:2.00]
-; SKYLAKE-NEXT:    rclq %cl, (%rdx) # sched: [15:2.50]
-; SKYLAKE-NEXT:    rcrq %cl, (%rdx) # sched: [18:2.25]
+; SKYLAKE-NEXT:    pause # sched: [4:1.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_rcl_rcr_64:
+; SKX-LABEL: test_pause:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    rclq %rdi # sched: [3:0.75]
-; SKX-NEXT:    rcrq %rdi # sched: [3:0.75]
-; SKX-NEXT:    rclq (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcrq (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rclq $7, %rdi # sched: [3:0.75]
-; SKX-NEXT:    rcrq $7, %rdi # sched: [3:0.75]
-; SKX-NEXT:    rclq $7, (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rcrq $7, (%rdx) # sched: [8:0.75]
-; SKX-NEXT:    rclq %cl, %rdi # sched: [11:2.00]
-; SKX-NEXT:    rcrq %cl, %rdi # sched: [11:2.00]
-; SKX-NEXT:    rclq %cl, (%rdx) # sched: [15:2.50]
-; SKX-NEXT:    rcrq %cl, (%rdx) # sched: [18:2.25]
+; SKX-NEXT:    pause # sched: [140:1.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_rcl_rcr_64:
+; BTVER2-LABEL: test_pause:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    rclq %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rcrq %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rclq (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrq (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rclq $7, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rcrq $7, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rclq $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrq $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rclq %cl, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rcrq %cl, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rclq %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rcrq %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    pause # sched: [1:?]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_rcl_rcr_64:
+; ZNVER1-LABEL: test_pause:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    rclq %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrq %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rclq (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrq (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rclq $7, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrq $7, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rclq $7, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrq $7, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rclq %cl, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rcrq %cl, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rclq %cl, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    rcrq %cl, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    pause # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "rclq $0 \0A\09 rcrq $0 \0A\09 rclq $2 \0A\09 rcrq $2 \0A\09 rclq $3, $0 \0A\09 rcrq $3, $0 \0A\09 rclq $3, $2 \0A\09 rcrq $3, $2 \0A\09 rclq %CL, $0 \0A\09 rcrq %CL, $0 \0A\09 rclq %CL, $2 \0A\09 rcrq %CL, $2", "r,r,*m,i"(i64 %a0, i64 %a1, i64 *%a2, i8 7)
+  call void asm sideeffect "pause", ""()
   ret void
 }
 
-; TODO - test_ret
+; TODO - test_pop
+; TODO - test_popa
+; TODO - test_popf
+; TODO - test_popfd
+; TODO - test_popfq
 
-define void @test_rol_ror_8(i8 %a0, i8 %a1, i8 *%a2) optsize {
-; GENERIC-LABEL: test_rol_ror_8:
+; TODO - test_prefetch
+; TODO - test_prefetchw
+; TODO - test_prefetchX
+
+; TODO - test_push
+; TODO - test_pusha
+; TODO - test_pushad
+; TODO - test_pushf
+; TODO - test_pushfd
+; TODO - test_pushfq
+
+define void @test_rcl_rcr_8(i8 %a0, i8 %a1, i8 *%a2) optsize {
+; GENERIC-LABEL: test_rcl_rcr_8:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    rolb %dil # sched: [1:0.50]
-; GENERIC-NEXT:    rorb %dil # sched: [1:0.50]
-; GENERIC-NEXT:    rolb (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rorb (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rolb $7, %dil # sched: [2:1.00]
-; GENERIC-NEXT:    rorb $7, %dil # sched: [2:1.00]
-; GENERIC-NEXT:    rolb $7, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    rorb $7, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    rolb %cl, %dil # sched: [3:1.50]
-; GENERIC-NEXT:    rorb %cl, %dil # sched: [3:1.50]
-; GENERIC-NEXT:    rolb %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    rorb %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rclb %dil # sched: [1:0.50]
+; GENERIC-NEXT:    rcrb %dil # sched: [1:0.50]
+; GENERIC-NEXT:    rclb (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrb (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rclb $7, %dil # sched: [1:0.50]
+; GENERIC-NEXT:    rcrb $7, %dil # sched: [1:0.50]
+; GENERIC-NEXT:    rclb $7, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrb $7, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rclb %cl, %dil # sched: [1:0.50]
+; GENERIC-NEXT:    rcrb %cl, %dil # sched: [1:0.50]
+; GENERIC-NEXT:    rclb %cl, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrb %cl, (%rdx) # sched: [5:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_rol_ror_8:
+; ATOM-LABEL: test_rcl_rcr_8:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    rolb %dil # sched: [1:1.00]
-; ATOM-NEXT:    rorb %dil # sched: [1:1.00]
-; ATOM-NEXT:    rolb (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorb (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rolb $7, %dil # sched: [1:1.00]
-; ATOM-NEXT:    rorb $7, %dil # sched: [1:1.00]
-; ATOM-NEXT:    rolb $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorb $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rolb %cl, %dil # sched: [1:1.00]
-; ATOM-NEXT:    rorb %cl, %dil # sched: [1:1.00]
-; ATOM-NEXT:    rolb %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorb %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rclb %dil # sched: [1:1.00]
+; ATOM-NEXT:    rcrb %dil # sched: [1:1.00]
+; ATOM-NEXT:    rclb (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrb (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rclb $7, %dil # sched: [1:1.00]
+; ATOM-NEXT:    rcrb $7, %dil # sched: [1:1.00]
+; ATOM-NEXT:    rclb $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrb $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rclb %cl, %dil # sched: [1:1.00]
+; ATOM-NEXT:    rcrb %cl, %dil # sched: [1:1.00]
+; ATOM-NEXT:    rclb %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrb %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_rol_ror_8:
+; SLM-LABEL: test_rcl_rcr_8:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    rolb %dil # sched: [1:1.00]
-; SLM-NEXT:    rorb %dil # sched: [1:1.00]
-; SLM-NEXT:    rolb (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorb (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rolb $7, %dil # sched: [1:1.00]
-; SLM-NEXT:    rorb $7, %dil # sched: [1:1.00]
-; SLM-NEXT:    rolb $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorb $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rolb %cl, %dil # sched: [1:1.00]
-; SLM-NEXT:    rorb %cl, %dil # sched: [1:1.00]
-; SLM-NEXT:    rolb %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorb %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rclb %dil # sched: [1:1.00]
+; SLM-NEXT:    rcrb %dil # sched: [1:1.00]
+; SLM-NEXT:    rclb (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrb (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rclb $7, %dil # sched: [1:1.00]
+; SLM-NEXT:    rcrb $7, %dil # sched: [1:1.00]
+; SLM-NEXT:    rclb $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrb $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rclb %cl, %dil # sched: [1:1.00]
+; SLM-NEXT:    rcrb %cl, %dil # sched: [1:1.00]
+; SLM-NEXT:    rclb %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrb %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_rol_ror_8:
+; SANDY-LABEL: test_rcl_rcr_8:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    rolb %dil # sched: [1:0.50]
-; SANDY-NEXT:    rorb %dil # sched: [1:0.50]
-; SANDY-NEXT:    rolb (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rorb (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rolb $7, %dil # sched: [2:1.00]
-; SANDY-NEXT:    rorb $7, %dil # sched: [2:1.00]
-; SANDY-NEXT:    rolb $7, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    rorb $7, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    rolb %cl, %dil # sched: [3:1.50]
-; SANDY-NEXT:    rorb %cl, %dil # sched: [3:1.50]
-; SANDY-NEXT:    rolb %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    rorb %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rclb %dil # sched: [1:0.50]
+; SANDY-NEXT:    rcrb %dil # sched: [1:0.50]
+; SANDY-NEXT:    rclb (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrb (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rclb $7, %dil # sched: [1:0.50]
+; SANDY-NEXT:    rcrb $7, %dil # sched: [1:0.50]
+; SANDY-NEXT:    rclb $7, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrb $7, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rclb %cl, %dil # sched: [1:0.50]
+; SANDY-NEXT:    rcrb %cl, %dil # sched: [1:0.50]
+; SANDY-NEXT:    rclb %cl, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrb %cl, (%rdx) # sched: [5:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_rol_ror_8:
+; HASWELL-LABEL: test_rcl_rcr_8:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    rolb %dil # sched: [2:1.00]
-; HASWELL-NEXT:    rorb %dil # sched: [2:1.00]
-; HASWELL-NEXT:    rolb (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rorb (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rolb $7, %dil # sched: [2:1.00]
-; HASWELL-NEXT:    rorb $7, %dil # sched: [2:1.00]
-; HASWELL-NEXT:    rolb $7, (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rorb $7, (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rolb %cl, %dil # sched: [3:1.00]
-; HASWELL-NEXT:    rorb %cl, %dil # sched: [3:1.00]
-; HASWELL-NEXT:    rolb %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    rorb %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rclb %dil # sched: [3:0.75]
+; HASWELL-NEXT:    rcrb %dil # sched: [3:0.75]
+; HASWELL-NEXT:    rclb (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcrb (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rclb $7, %dil # sched: [3:0.75]
+; HASWELL-NEXT:    rcrb $7, %dil # sched: [3:0.75]
+; HASWELL-NEXT:    rclb $7, (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcrb $7, (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rclb %cl, %dil # sched: [11:2.25]
+; HASWELL-NEXT:    rcrb %cl, %dil # sched: [14:2.50]
+; HASWELL-NEXT:    rclb %cl, (%rdx) # sched: [16:2.00]
+; HASWELL-NEXT:    rcrb %cl, (%rdx) # sched: [19:2.25]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_rol_ror_8:
+; BROADWELL-LABEL: test_rcl_rcr_8:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    rolb %dil # sched: [2:1.00]
-; BROADWELL-NEXT:    rorb %dil # sched: [2:1.00]
-; BROADWELL-NEXT:    rolb (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rorb (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rolb $7, %dil # sched: [2:1.00]
-; BROADWELL-NEXT:    rorb $7, %dil # sched: [2:1.00]
-; BROADWELL-NEXT:    rolb $7, (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rorb $7, (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rolb %cl, %dil # sched: [3:1.00]
-; BROADWELL-NEXT:    rorb %cl, %dil # sched: [3:1.00]
-; BROADWELL-NEXT:    rolb %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    rorb %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rclb %dil # sched: [3:0.75]
+; BROADWELL-NEXT:    rcrb %dil # sched: [3:0.75]
+; BROADWELL-NEXT:    rclb (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcrb (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rclb $7, %dil # sched: [3:0.75]
+; BROADWELL-NEXT:    rcrb $7, %dil # sched: [3:0.75]
+; BROADWELL-NEXT:    rclb $7, (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcrb $7, (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rclb %cl, %dil # sched: [11:2.25]
+; BROADWELL-NEXT:    rcrb %cl, %dil # sched: [14:2.50]
+; BROADWELL-NEXT:    rclb %cl, (%rdx) # sched: [15:2.00]
+; BROADWELL-NEXT:    rcrb %cl, (%rdx) # sched: [18:2.25]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_rol_ror_8:
+; SKYLAKE-LABEL: test_rcl_rcr_8:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    rolb %dil # sched: [2:1.00]
-; SKYLAKE-NEXT:    rorb %dil # sched: [2:1.00]
-; SKYLAKE-NEXT:    rolb (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rorb (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rolb $7, %dil # sched: [2:1.00]
-; SKYLAKE-NEXT:    rorb $7, %dil # sched: [2:1.00]
-; SKYLAKE-NEXT:    rolb $7, (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rorb $7, (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rolb %cl, %dil # sched: [3:1.50]
-; SKYLAKE-NEXT:    rorb %cl, %dil # sched: [3:1.50]
-; SKYLAKE-NEXT:    rolb %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    rorb %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rclb %dil # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcrb %dil # sched: [3:0.75]
+; SKYLAKE-NEXT:    rclb (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcrb (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rclb $7, %dil # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcrb $7, %dil # sched: [3:0.75]
+; SKYLAKE-NEXT:    rclb $7, (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcrb $7, (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rclb %cl, %dil # sched: [11:2.50]
+; SKYLAKE-NEXT:    rcrb %cl, %dil # sched: [14:2.50]
+; SKYLAKE-NEXT:    rclb %cl, (%rdx) # sched: [15:2.50]
+; SKYLAKE-NEXT:    rcrb %cl, (%rdx) # sched: [18:2.25]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_rol_ror_8:
+; SKX-LABEL: test_rcl_rcr_8:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    rolb %dil # sched: [2:1.00]
-; SKX-NEXT:    rorb %dil # sched: [2:1.00]
-; SKX-NEXT:    rolb (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rorb (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rolb $7, %dil # sched: [2:1.00]
-; SKX-NEXT:    rorb $7, %dil # sched: [2:1.00]
-; SKX-NEXT:    rolb $7, (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rorb $7, (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rolb %cl, %dil # sched: [3:1.50]
-; SKX-NEXT:    rorb %cl, %dil # sched: [3:1.50]
-; SKX-NEXT:    rolb %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    rorb %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rclb %dil # sched: [3:0.75]
+; SKX-NEXT:    rcrb %dil # sched: [3:0.75]
+; SKX-NEXT:    rclb (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcrb (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rclb $7, %dil # sched: [3:0.75]
+; SKX-NEXT:    rcrb $7, %dil # sched: [3:0.75]
+; SKX-NEXT:    rclb $7, (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcrb $7, (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rclb %cl, %dil # sched: [11:2.50]
+; SKX-NEXT:    rcrb %cl, %dil # sched: [14:2.50]
+; SKX-NEXT:    rclb %cl, (%rdx) # sched: [15:2.50]
+; SKX-NEXT:    rcrb %cl, (%rdx) # sched: [18:2.25]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_rol_ror_8:
+; BTVER2-LABEL: test_rcl_rcr_8:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    rolb %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rorb %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rolb (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorb (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rolb $7, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rorb $7, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rolb $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorb $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rolb %cl, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rorb %cl, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    rolb %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorb %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rclb %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rcrb %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rclb (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrb (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rclb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rcrb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rclb $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrb $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rclb %cl, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rcrb %cl, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rclb %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrb %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_rol_ror_8:
+; ZNVER1-LABEL: test_rcl_rcr_8:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    rolb %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rorb %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rolb (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorb (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rolb $7, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rorb $7, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rolb $7, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorb $7, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rolb %cl, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rorb %cl, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    rolb %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorb %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rclb %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrb %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rclb (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrb (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rclb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rclb $7, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrb $7, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rclb %cl, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrb %cl, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rclb %cl, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrb %cl, (%rdx) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "rolb $0 \0A\09 rorb $0 \0A\09 rolb $2 \0A\09 rorb $2 \0A\09 rolb $3, $0 \0A\09 rorb $3, $0 \0A\09 rolb $3, $2 \0A\09 rorb $3, $2 \0A\09 rolb %CL, $0 \0A\09 rorb %CL, $0 \0A\09 rolb %CL, $2 \0A\09 rorb %CL, $2", "r,r,*m,i"(i8 %a0, i8 %a1, i8 *%a2, i8 7)
+  call void asm sideeffect "rclb $0 \0A\09 rcrb $0 \0A\09 rclb $2 \0A\09 rcrb $2 \0A\09 rclb $3, $0 \0A\09 rcrb $3, $0 \0A\09 rclb $3, $2 \0A\09 rcrb $3, $2 \0A\09 rclb %CL, $0 \0A\09 rcrb %CL, $0 \0A\09 rclb %CL, $2 \0A\09 rcrb %CL, $2", "r,r,*m,i"(i8 %a0, i8 %a1, i8 *%a2, i8 7)
   ret void
 }
-define void @test_rol_ror_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
-; GENERIC-LABEL: test_rol_ror_16:
+define void @test_rcl_rcr_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
+; GENERIC-LABEL: test_rcl_rcr_16:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    rolw %di # sched: [1:0.50]
-; GENERIC-NEXT:    rorw %di # sched: [1:0.50]
-; GENERIC-NEXT:    rolw (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rorw (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rolw $7, %di # sched: [2:1.00]
-; GENERIC-NEXT:    rorw $7, %di # sched: [2:1.00]
-; GENERIC-NEXT:    rolw $7, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    rorw $7, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    rolw %cl, %di # sched: [3:1.50]
-; GENERIC-NEXT:    rorw %cl, %di # sched: [3:1.50]
-; GENERIC-NEXT:    rolw %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    rorw %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rclw %di # sched: [1:0.50]
+; GENERIC-NEXT:    rcrw %di # sched: [1:0.50]
+; GENERIC-NEXT:    rclw (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrw (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rclw $7, %di # sched: [1:0.50]
+; GENERIC-NEXT:    rcrw $7, %di # sched: [1:0.50]
+; GENERIC-NEXT:    rclw $7, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrw $7, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rclw %cl, %di # sched: [1:0.50]
+; GENERIC-NEXT:    rcrw %cl, %di # sched: [1:0.50]
+; GENERIC-NEXT:    rclw %cl, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrw %cl, (%rdx) # sched: [5:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_rol_ror_16:
+; ATOM-LABEL: test_rcl_rcr_16:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    rolw %di # sched: [1:1.00]
-; ATOM-NEXT:    rorw %di # sched: [1:1.00]
-; ATOM-NEXT:    rolw (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorw (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rolw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    rorw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    rolw $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorw $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rolw %cl, %di # sched: [1:1.00]
-; ATOM-NEXT:    rorw %cl, %di # sched: [1:1.00]
-; ATOM-NEXT:    rolw %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorw %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rclw %di # sched: [1:1.00]
+; ATOM-NEXT:    rcrw %di # sched: [1:1.00]
+; ATOM-NEXT:    rclw (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrw (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rclw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    rcrw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    rclw $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrw $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rclw %cl, %di # sched: [1:1.00]
+; ATOM-NEXT:    rcrw %cl, %di # sched: [1:1.00]
+; ATOM-NEXT:    rclw %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrw %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_rol_ror_16:
+; SLM-LABEL: test_rcl_rcr_16:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    rolw %di # sched: [1:1.00]
-; SLM-NEXT:    rorw %di # sched: [1:1.00]
-; SLM-NEXT:    rolw (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorw (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rolw $7, %di # sched: [1:1.00]
-; SLM-NEXT:    rorw $7, %di # sched: [1:1.00]
-; SLM-NEXT:    rolw $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorw $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rolw %cl, %di # sched: [1:1.00]
-; SLM-NEXT:    rorw %cl, %di # sched: [1:1.00]
-; SLM-NEXT:    rolw %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorw %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rclw %di # sched: [1:1.00]
+; SLM-NEXT:    rcrw %di # sched: [1:1.00]
+; SLM-NEXT:    rclw (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrw (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rclw $7, %di # sched: [1:1.00]
+; SLM-NEXT:    rcrw $7, %di # sched: [1:1.00]
+; SLM-NEXT:    rclw $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrw $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rclw %cl, %di # sched: [1:1.00]
+; SLM-NEXT:    rcrw %cl, %di # sched: [1:1.00]
+; SLM-NEXT:    rclw %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrw %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_rol_ror_16:
+; SANDY-LABEL: test_rcl_rcr_16:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    rolw %di # sched: [1:0.50]
-; SANDY-NEXT:    rorw %di # sched: [1:0.50]
-; SANDY-NEXT:    rolw (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rorw (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rolw $7, %di # sched: [2:1.00]
-; SANDY-NEXT:    rorw $7, %di # sched: [2:1.00]
-; SANDY-NEXT:    rolw $7, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    rorw $7, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    rolw %cl, %di # sched: [3:1.50]
-; SANDY-NEXT:    rorw %cl, %di # sched: [3:1.50]
-; SANDY-NEXT:    rolw %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    rorw %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rclw %di # sched: [1:0.50]
+; SANDY-NEXT:    rcrw %di # sched: [1:0.50]
+; SANDY-NEXT:    rclw (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrw (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rclw $7, %di # sched: [1:0.50]
+; SANDY-NEXT:    rcrw $7, %di # sched: [1:0.50]
+; SANDY-NEXT:    rclw $7, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrw $7, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rclw %cl, %di # sched: [1:0.50]
+; SANDY-NEXT:    rcrw %cl, %di # sched: [1:0.50]
+; SANDY-NEXT:    rclw %cl, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrw %cl, (%rdx) # sched: [5:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_rol_ror_16:
+; HASWELL-LABEL: test_rcl_rcr_16:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    rolw %di # sched: [2:1.00]
-; HASWELL-NEXT:    rorw %di # sched: [2:1.00]
-; HASWELL-NEXT:    rolw (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rorw (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rolw $7, %di # sched: [2:1.00]
-; HASWELL-NEXT:    rorw $7, %di # sched: [2:1.00]
-; HASWELL-NEXT:    rolw $7, (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rorw $7, (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rolw %cl, %di # sched: [3:1.00]
-; HASWELL-NEXT:    rorw %cl, %di # sched: [3:1.00]
-; HASWELL-NEXT:    rolw %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    rorw %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rclw %di # sched: [3:0.75]
+; HASWELL-NEXT:    rcrw %di # sched: [3:0.75]
+; HASWELL-NEXT:    rclw (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcrw (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rclw $7, %di # sched: [3:0.75]
+; HASWELL-NEXT:    rcrw $7, %di # sched: [3:0.75]
+; HASWELL-NEXT:    rclw $7, (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcrw $7, (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rclw %cl, %di # sched: [11:2.00]
+; HASWELL-NEXT:    rcrw %cl, %di # sched: [11:2.00]
+; HASWELL-NEXT:    rclw %cl, (%rdx) # sched: [16:2.00]
+; HASWELL-NEXT:    rcrw %cl, (%rdx) # sched: [19:2.25]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_rol_ror_16:
+; BROADWELL-LABEL: test_rcl_rcr_16:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    rolw %di # sched: [2:1.00]
-; BROADWELL-NEXT:    rorw %di # sched: [2:1.00]
-; BROADWELL-NEXT:    rolw (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rorw (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rolw $7, %di # sched: [2:1.00]
-; BROADWELL-NEXT:    rorw $7, %di # sched: [2:1.00]
-; BROADWELL-NEXT:    rolw $7, (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rorw $7, (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rolw %cl, %di # sched: [3:1.00]
-; BROADWELL-NEXT:    rorw %cl, %di # sched: [3:1.00]
-; BROADWELL-NEXT:    rolw %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    rorw %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rclw %di # sched: [3:0.75]
+; BROADWELL-NEXT:    rcrw %di # sched: [3:0.75]
+; BROADWELL-NEXT:    rclw (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcrw (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rclw $7, %di # sched: [3:0.75]
+; BROADWELL-NEXT:    rcrw $7, %di # sched: [3:0.75]
+; BROADWELL-NEXT:    rclw $7, (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcrw $7, (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rclw %cl, %di # sched: [11:2.00]
+; BROADWELL-NEXT:    rcrw %cl, %di # sched: [11:2.00]
+; BROADWELL-NEXT:    rclw %cl, (%rdx) # sched: [15:2.00]
+; BROADWELL-NEXT:    rcrw %cl, (%rdx) # sched: [18:2.25]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_rol_ror_16:
+; SKYLAKE-LABEL: test_rcl_rcr_16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    rolw %di # sched: [2:1.00]
-; SKYLAKE-NEXT:    rorw %di # sched: [2:1.00]
-; SKYLAKE-NEXT:    rolw (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rorw (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rolw $7, %di # sched: [2:1.00]
-; SKYLAKE-NEXT:    rorw $7, %di # sched: [2:1.00]
-; SKYLAKE-NEXT:    rolw $7, (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rorw $7, (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rolw %cl, %di # sched: [3:1.50]
-; SKYLAKE-NEXT:    rorw %cl, %di # sched: [3:1.50]
-; SKYLAKE-NEXT:    rolw %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    rorw %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rclw %di # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcrw %di # sched: [3:0.75]
+; SKYLAKE-NEXT:    rclw (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcrw (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rclw $7, %di # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcrw $7, %di # sched: [3:0.75]
+; SKYLAKE-NEXT:    rclw $7, (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcrw $7, (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rclw %cl, %di # sched: [11:2.00]
+; SKYLAKE-NEXT:    rcrw %cl, %di # sched: [11:2.00]
+; SKYLAKE-NEXT:    rclw %cl, (%rdx) # sched: [15:2.50]
+; SKYLAKE-NEXT:    rcrw %cl, (%rdx) # sched: [18:2.25]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_rol_ror_16:
+; SKX-LABEL: test_rcl_rcr_16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    rolw %di # sched: [2:1.00]
-; SKX-NEXT:    rorw %di # sched: [2:1.00]
-; SKX-NEXT:    rolw (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rorw (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rolw $7, %di # sched: [2:1.00]
-; SKX-NEXT:    rorw $7, %di # sched: [2:1.00]
-; SKX-NEXT:    rolw $7, (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rorw $7, (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rolw %cl, %di # sched: [3:1.50]
-; SKX-NEXT:    rorw %cl, %di # sched: [3:1.50]
-; SKX-NEXT:    rolw %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    rorw %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rclw %di # sched: [3:0.75]
+; SKX-NEXT:    rcrw %di # sched: [3:0.75]
+; SKX-NEXT:    rclw (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcrw (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rclw $7, %di # sched: [3:0.75]
+; SKX-NEXT:    rcrw $7, %di # sched: [3:0.75]
+; SKX-NEXT:    rclw $7, (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcrw $7, (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rclw %cl, %di # sched: [11:2.00]
+; SKX-NEXT:    rcrw %cl, %di # sched: [11:2.00]
+; SKX-NEXT:    rclw %cl, (%rdx) # sched: [15:2.50]
+; SKX-NEXT:    rcrw %cl, (%rdx) # sched: [18:2.25]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_rol_ror_16:
+; BTVER2-LABEL: test_rcl_rcr_16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    rolw %di # sched: [1:0.50]
-; BTVER2-NEXT:    rorw %di # sched: [1:0.50]
-; BTVER2-NEXT:    rolw (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorw (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rolw $7, %di # sched: [1:0.50]
-; BTVER2-NEXT:    rorw $7, %di # sched: [1:0.50]
-; BTVER2-NEXT:    rolw $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorw $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rolw %cl, %di # sched: [1:0.50]
-; BTVER2-NEXT:    rorw %cl, %di # sched: [1:0.50]
-; BTVER2-NEXT:    rolw %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorw %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rclw %di # sched: [1:0.50]
+; BTVER2-NEXT:    rcrw %di # sched: [1:0.50]
+; BTVER2-NEXT:    rclw (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrw (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rclw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    rcrw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    rclw $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrw $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rclw %cl, %di # sched: [1:0.50]
+; BTVER2-NEXT:    rcrw %cl, %di # sched: [1:0.50]
+; BTVER2-NEXT:    rclw %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrw %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_rol_ror_16:
+; ZNVER1-LABEL: test_rcl_rcr_16:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    rolw %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rorw %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rolw (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorw (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rolw $7, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rorw $7, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rolw $7, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorw $7, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rolw %cl, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rorw %cl, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    rolw %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorw %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rclw %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrw %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rclw (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrw (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rclw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rclw $7, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrw $7, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rclw %cl, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrw %cl, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rclw %cl, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrw %cl, (%rdx) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "rolw $0 \0A\09 rorw $0 \0A\09 rolw $2 \0A\09 rorw $2 \0A\09 rolw $3, $0 \0A\09 rorw $3, $0 \0A\09 rolw $3, $2 \0A\09 rorw $3, $2 \0A\09 rolw %CL, $0 \0A\09 rorw %CL, $0 \0A\09 rolw %CL, $2 \0A\09 rorw %CL, $2", "r,r,*m,i"(i16 %a0, i16 %a1, i16 *%a2, i8 7)
+  call void asm sideeffect "rclw $0 \0A\09 rcrw $0 \0A\09 rclw $2 \0A\09 rcrw $2 \0A\09 rclw $3, $0 \0A\09 rcrw $3, $0 \0A\09 rclw $3, $2 \0A\09 rcrw $3, $2 \0A\09 rclw %CL, $0 \0A\09 rcrw %CL, $0 \0A\09 rclw %CL, $2 \0A\09 rcrw %CL, $2", "r,r,*m,i"(i16 %a0, i16 %a1, i16 *%a2, i8 7)
   ret void
 }
-define void @test_rol_ror_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
-; GENERIC-LABEL: test_rol_ror_32:
+define void @test_rcl_rcr_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
+; GENERIC-LABEL: test_rcl_rcr_32:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    roll %edi # sched: [1:0.50]
-; GENERIC-NEXT:    rorl %edi # sched: [1:0.50]
-; GENERIC-NEXT:    roll (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rorl (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    roll $7, %edi # sched: [2:1.00]
-; GENERIC-NEXT:    rorl $7, %edi # sched: [2:1.00]
-; GENERIC-NEXT:    roll $7, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    rorl $7, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    roll %cl, %edi # sched: [3:1.50]
-; GENERIC-NEXT:    rorl %cl, %edi # sched: [3:1.50]
-; GENERIC-NEXT:    roll %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    rorl %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rcll %edi # sched: [1:0.50]
+; GENERIC-NEXT:    rcrl %edi # sched: [1:0.50]
+; GENERIC-NEXT:    rcll (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrl (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcll $7, %edi # sched: [1:0.50]
+; GENERIC-NEXT:    rcrl $7, %edi # sched: [1:0.50]
+; GENERIC-NEXT:    rcll $7, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrl $7, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcll %cl, %edi # sched: [1:0.50]
+; GENERIC-NEXT:    rcrl %cl, %edi # sched: [1:0.50]
+; GENERIC-NEXT:    rcll %cl, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrl %cl, (%rdx) # sched: [5:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_rol_ror_32:
+; ATOM-LABEL: test_rcl_rcr_32:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    roll %edi # sched: [1:1.00]
-; ATOM-NEXT:    rorl %edi # sched: [1:1.00]
-; ATOM-NEXT:    roll (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorl (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    roll $7, %edi # sched: [1:1.00]
-; ATOM-NEXT:    rorl $7, %edi # sched: [1:1.00]
-; ATOM-NEXT:    roll $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorl $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    roll %cl, %edi # sched: [1:1.00]
-; ATOM-NEXT:    rorl %cl, %edi # sched: [1:1.00]
-; ATOM-NEXT:    roll %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorl %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcll %edi # sched: [1:1.00]
+; ATOM-NEXT:    rcrl %edi # sched: [1:1.00]
+; ATOM-NEXT:    rcll (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrl (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcll $7, %edi # sched: [1:1.00]
+; ATOM-NEXT:    rcrl $7, %edi # sched: [1:1.00]
+; ATOM-NEXT:    rcll $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrl $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcll %cl, %edi # sched: [1:1.00]
+; ATOM-NEXT:    rcrl %cl, %edi # sched: [1:1.00]
+; ATOM-NEXT:    rcll %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrl %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_rol_ror_32:
+; SLM-LABEL: test_rcl_rcr_32:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    roll %edi # sched: [1:1.00]
-; SLM-NEXT:    rorl %edi # sched: [1:1.00]
-; SLM-NEXT:    roll (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorl (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    roll $7, %edi # sched: [1:1.00]
-; SLM-NEXT:    rorl $7, %edi # sched: [1:1.00]
-; SLM-NEXT:    roll $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorl $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    roll %cl, %edi # sched: [1:1.00]
-; SLM-NEXT:    rorl %cl, %edi # sched: [1:1.00]
-; SLM-NEXT:    roll %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorl %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    #NO_APP
-; SLM-NEXT:    retq # sched: [4:1.00]
-;
-; SANDY-LABEL: test_rol_ror_32:
-; SANDY:       # %bb.0:
-; SANDY-NEXT:    #APP
-; SANDY-NEXT:    roll %edi # sched: [1:0.50]
-; SANDY-NEXT:    rorl %edi # sched: [1:0.50]
-; SANDY-NEXT:    roll (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rorl (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    roll $7, %edi # sched: [2:1.00]
-; SANDY-NEXT:    rorl $7, %edi # sched: [2:1.00]
-; SANDY-NEXT:    roll $7, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    rorl $7, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    roll %cl, %edi # sched: [3:1.50]
-; SANDY-NEXT:    rorl %cl, %edi # sched: [3:1.50]
-; SANDY-NEXT:    roll %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    rorl %cl, (%rdx) # sched: [9:1.50]
+; SLM-NEXT:    rcll %edi # sched: [1:1.00]
+; SLM-NEXT:    rcrl %edi # sched: [1:1.00]
+; SLM-NEXT:    rcll (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrl (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcll $7, %edi # sched: [1:1.00]
+; SLM-NEXT:    rcrl $7, %edi # sched: [1:1.00]
+; SLM-NEXT:    rcll $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrl $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcll %cl, %edi # sched: [1:1.00]
+; SLM-NEXT:    rcrl %cl, %edi # sched: [1:1.00]
+; SLM-NEXT:    rcll %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrl %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_rcl_rcr_32:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    rcll %edi # sched: [1:0.50]
+; SANDY-NEXT:    rcrl %edi # sched: [1:0.50]
+; SANDY-NEXT:    rcll (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrl (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcll $7, %edi # sched: [1:0.50]
+; SANDY-NEXT:    rcrl $7, %edi # sched: [1:0.50]
+; SANDY-NEXT:    rcll $7, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrl $7, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcll %cl, %edi # sched: [1:0.50]
+; SANDY-NEXT:    rcrl %cl, %edi # sched: [1:0.50]
+; SANDY-NEXT:    rcll %cl, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrl %cl, (%rdx) # sched: [5:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_rol_ror_32:
+; HASWELL-LABEL: test_rcl_rcr_32:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    roll %edi # sched: [2:1.00]
-; HASWELL-NEXT:    rorl %edi # sched: [2:1.00]
-; HASWELL-NEXT:    roll (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rorl (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    roll $7, %edi # sched: [2:1.00]
-; HASWELL-NEXT:    rorl $7, %edi # sched: [2:1.00]
-; HASWELL-NEXT:    roll $7, (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rorl $7, (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    roll %cl, %edi # sched: [3:1.00]
-; HASWELL-NEXT:    rorl %cl, %edi # sched: [3:1.00]
-; HASWELL-NEXT:    roll %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    rorl %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rcll %edi # sched: [3:0.75]
+; HASWELL-NEXT:    rcrl %edi # sched: [3:0.75]
+; HASWELL-NEXT:    rcll (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcrl (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcll $7, %edi # sched: [3:0.75]
+; HASWELL-NEXT:    rcrl $7, %edi # sched: [3:0.75]
+; HASWELL-NEXT:    rcll $7, (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcrl $7, (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcll %cl, %edi # sched: [11:2.00]
+; HASWELL-NEXT:    rcrl %cl, %edi # sched: [11:2.00]
+; HASWELL-NEXT:    rcll %cl, (%rdx) # sched: [16:2.00]
+; HASWELL-NEXT:    rcrl %cl, (%rdx) # sched: [19:2.25]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_rol_ror_32:
+; BROADWELL-LABEL: test_rcl_rcr_32:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    roll %edi # sched: [2:1.00]
-; BROADWELL-NEXT:    rorl %edi # sched: [2:1.00]
-; BROADWELL-NEXT:    roll (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rorl (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    roll $7, %edi # sched: [2:1.00]
-; BROADWELL-NEXT:    rorl $7, %edi # sched: [2:1.00]
-; BROADWELL-NEXT:    roll $7, (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rorl $7, (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    roll %cl, %edi # sched: [3:1.00]
-; BROADWELL-NEXT:    rorl %cl, %edi # sched: [3:1.00]
-; BROADWELL-NEXT:    roll %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    rorl %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rcll %edi # sched: [3:0.75]
+; BROADWELL-NEXT:    rcrl %edi # sched: [3:0.75]
+; BROADWELL-NEXT:    rcll (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcrl (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcll $7, %edi # sched: [3:0.75]
+; BROADWELL-NEXT:    rcrl $7, %edi # sched: [3:0.75]
+; BROADWELL-NEXT:    rcll $7, (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcrl $7, (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcll %cl, %edi # sched: [11:2.00]
+; BROADWELL-NEXT:    rcrl %cl, %edi # sched: [11:2.00]
+; BROADWELL-NEXT:    rcll %cl, (%rdx) # sched: [15:2.00]
+; BROADWELL-NEXT:    rcrl %cl, (%rdx) # sched: [18:2.25]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_rol_ror_32:
+; SKYLAKE-LABEL: test_rcl_rcr_32:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    roll %edi # sched: [2:1.00]
-; SKYLAKE-NEXT:    rorl %edi # sched: [2:1.00]
-; SKYLAKE-NEXT:    roll (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rorl (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    roll $7, %edi # sched: [2:1.00]
-; SKYLAKE-NEXT:    rorl $7, %edi # sched: [2:1.00]
-; SKYLAKE-NEXT:    roll $7, (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rorl $7, (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    roll %cl, %edi # sched: [3:1.50]
-; SKYLAKE-NEXT:    rorl %cl, %edi # sched: [3:1.50]
-; SKYLAKE-NEXT:    roll %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    rorl %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rcll %edi # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcrl %edi # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcll (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcrl (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcll $7, %edi # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcrl $7, %edi # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcll $7, (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcrl $7, (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcll %cl, %edi # sched: [11:2.00]
+; SKYLAKE-NEXT:    rcrl %cl, %edi # sched: [11:2.00]
+; SKYLAKE-NEXT:    rcll %cl, (%rdx) # sched: [15:2.50]
+; SKYLAKE-NEXT:    rcrl %cl, (%rdx) # sched: [18:2.25]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_rol_ror_32:
+; SKX-LABEL: test_rcl_rcr_32:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    roll %edi # sched: [2:1.00]
-; SKX-NEXT:    rorl %edi # sched: [2:1.00]
-; SKX-NEXT:    roll (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rorl (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    roll $7, %edi # sched: [2:1.00]
-; SKX-NEXT:    rorl $7, %edi # sched: [2:1.00]
-; SKX-NEXT:    roll $7, (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rorl $7, (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    roll %cl, %edi # sched: [3:1.50]
-; SKX-NEXT:    rorl %cl, %edi # sched: [3:1.50]
-; SKX-NEXT:    roll %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    rorl %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rcll %edi # sched: [3:0.75]
+; SKX-NEXT:    rcrl %edi # sched: [3:0.75]
+; SKX-NEXT:    rcll (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcrl (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcll $7, %edi # sched: [3:0.75]
+; SKX-NEXT:    rcrl $7, %edi # sched: [3:0.75]
+; SKX-NEXT:    rcll $7, (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcrl $7, (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcll %cl, %edi # sched: [11:2.00]
+; SKX-NEXT:    rcrl %cl, %edi # sched: [11:2.00]
+; SKX-NEXT:    rcll %cl, (%rdx) # sched: [15:2.50]
+; SKX-NEXT:    rcrl %cl, (%rdx) # sched: [18:2.25]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_rol_ror_32:
+; BTVER2-LABEL: test_rcl_rcr_32:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    roll %edi # sched: [1:0.50]
-; BTVER2-NEXT:    rorl %edi # sched: [1:0.50]
-; BTVER2-NEXT:    roll (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorl (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    roll $7, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    rorl $7, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    roll $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorl $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    roll %cl, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    rorl %cl, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    roll %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorl %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcll %edi # sched: [1:0.50]
+; BTVER2-NEXT:    rcrl %edi # sched: [1:0.50]
+; BTVER2-NEXT:    rcll (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrl (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcll $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    rcrl $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    rcll $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrl $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcll %cl, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    rcrl %cl, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    rcll %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrl %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_rol_ror_32:
+; ZNVER1-LABEL: test_rcl_rcr_32:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    roll %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    rorl %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    roll (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorl (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    roll $7, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    rorl $7, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    roll $7, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorl $7, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    roll %cl, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    rorl %cl, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    roll %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorl %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rcll %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrl %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    rcll (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrl (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcll $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrl $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    rcll $7, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrl $7, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcll %cl, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrl %cl, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    rcll %cl, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrl %cl, (%rdx) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "roll $0 \0A\09 rorl $0 \0A\09 roll $2 \0A\09 rorl $2 \0A\09 roll $3, $0 \0A\09 rorl $3, $0 \0A\09 roll $3, $2 \0A\09 rorl $3, $2 \0A\09 roll %CL, $0 \0A\09 rorl %CL, $0 \0A\09 roll %CL, $2 \0A\09 rorl %CL, $2", "r,r,*m,i"(i32 %a0, i32 %a1, i32 *%a2, i8 7)
+  call void asm sideeffect "rcll $0 \0A\09 rcrl $0 \0A\09 rcll $2 \0A\09 rcrl $2 \0A\09 rcll $3, $0 \0A\09 rcrl $3, $0 \0A\09 rcll $3, $2 \0A\09 rcrl $3, $2 \0A\09 rcll %CL, $0 \0A\09 rcrl %CL, $0 \0A\09 rcll %CL, $2 \0A\09 rcrl %CL, $2", "r,r,*m,i"(i32 %a0, i32 %a1, i32 *%a2, i8 7)
   ret void
 }
-define void @test_rol_ror_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
-; GENERIC-LABEL: test_rol_ror_64:
+define void @test_rcl_rcr_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
+; GENERIC-LABEL: test_rcl_rcr_64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    rolq %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    rorq %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    rolq (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rorq (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    rolq $7, %rdi # sched: [2:1.00]
-; GENERIC-NEXT:    rorq $7, %rdi # sched: [2:1.00]
-; GENERIC-NEXT:    rolq $7, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    rorq $7, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    rolq %cl, %rdi # sched: [3:1.50]
-; GENERIC-NEXT:    rorq %cl, %rdi # sched: [3:1.50]
-; GENERIC-NEXT:    rolq %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    rorq %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rclq %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    rcrq %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    rclq (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrq (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rclq $7, %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    rcrq $7, %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    rclq $7, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrq $7, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rclq %cl, %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    rcrq %cl, %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    rclq %cl, (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rcrq %cl, (%rdx) # sched: [5:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_rol_ror_64:
+; ATOM-LABEL: test_rcl_rcr_64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    rolq %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rorq %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rolq (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorq (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rolq $7, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rorq $7, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rolq $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorq $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rolq %cl, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rorq %cl, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    rolq %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    rorq %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rclq %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rcrq %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rclq (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrq (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rclq $7, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rcrq $7, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rclq $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrq $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rclq %cl, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rcrq %cl, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rclq %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rcrq %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_rol_ror_64:
+; SLM-LABEL: test_rcl_rcr_64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    rolq %rdi # sched: [1:1.00]
-; SLM-NEXT:    rorq %rdi # sched: [1:1.00]
-; SLM-NEXT:    rolq (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorq (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rolq $7, %rdi # sched: [1:1.00]
-; SLM-NEXT:    rorq $7, %rdi # sched: [1:1.00]
-; SLM-NEXT:    rolq $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorq $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rolq %cl, %rdi # sched: [1:1.00]
-; SLM-NEXT:    rorq %cl, %rdi # sched: [1:1.00]
-; SLM-NEXT:    rolq %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    rorq %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rclq %rdi # sched: [1:1.00]
+; SLM-NEXT:    rcrq %rdi # sched: [1:1.00]
+; SLM-NEXT:    rclq (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrq (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rclq $7, %rdi # sched: [1:1.00]
+; SLM-NEXT:    rcrq $7, %rdi # sched: [1:1.00]
+; SLM-NEXT:    rclq $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrq $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rclq %cl, %rdi # sched: [1:1.00]
+; SLM-NEXT:    rcrq %cl, %rdi # sched: [1:1.00]
+; SLM-NEXT:    rclq %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rcrq %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_rol_ror_64:
+; SANDY-LABEL: test_rcl_rcr_64:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    rolq %rdi # sched: [1:0.50]
-; SANDY-NEXT:    rorq %rdi # sched: [1:0.50]
-; SANDY-NEXT:    rolq (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rorq (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    rolq $7, %rdi # sched: [2:1.00]
-; SANDY-NEXT:    rorq $7, %rdi # sched: [2:1.00]
-; SANDY-NEXT:    rolq $7, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    rorq $7, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    rolq %cl, %rdi # sched: [3:1.50]
-; SANDY-NEXT:    rorq %cl, %rdi # sched: [3:1.50]
-; SANDY-NEXT:    rolq %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    rorq %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rclq %rdi # sched: [1:0.50]
+; SANDY-NEXT:    rcrq %rdi # sched: [1:0.50]
+; SANDY-NEXT:    rclq (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrq (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rclq $7, %rdi # sched: [1:0.50]
+; SANDY-NEXT:    rcrq $7, %rdi # sched: [1:0.50]
+; SANDY-NEXT:    rclq $7, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrq $7, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rclq %cl, %rdi # sched: [1:0.50]
+; SANDY-NEXT:    rcrq %cl, %rdi # sched: [1:0.50]
+; SANDY-NEXT:    rclq %cl, (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rcrq %cl, (%rdx) # sched: [5:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_rol_ror_64:
+; HASWELL-LABEL: test_rcl_rcr_64:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    rolq %rdi # sched: [2:1.00]
-; HASWELL-NEXT:    rorq %rdi # sched: [2:1.00]
-; HASWELL-NEXT:    rolq (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rorq (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rolq $7, %rdi # sched: [2:1.00]
-; HASWELL-NEXT:    rorq $7, %rdi # sched: [2:1.00]
-; HASWELL-NEXT:    rolq $7, (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rorq $7, (%rdx) # sched: [8:1.00]
-; HASWELL-NEXT:    rolq %cl, %rdi # sched: [3:1.00]
-; HASWELL-NEXT:    rorq %cl, %rdi # sched: [3:1.00]
-; HASWELL-NEXT:    rolq %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    rorq %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rclq %rdi # sched: [3:0.75]
+; HASWELL-NEXT:    rcrq %rdi # sched: [3:0.75]
+; HASWELL-NEXT:    rclq (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcrq (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rclq $7, %rdi # sched: [3:0.75]
+; HASWELL-NEXT:    rcrq $7, %rdi # sched: [3:0.75]
+; HASWELL-NEXT:    rclq $7, (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rcrq $7, (%rdx) # sched: [9:0.75]
+; HASWELL-NEXT:    rclq %cl, %rdi # sched: [11:2.00]
+; HASWELL-NEXT:    rcrq %cl, %rdi # sched: [11:2.00]
+; HASWELL-NEXT:    rclq %cl, (%rdx) # sched: [16:2.00]
+; HASWELL-NEXT:    rcrq %cl, (%rdx) # sched: [19:2.25]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_rol_ror_64:
+; BROADWELL-LABEL: test_rcl_rcr_64:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    rolq %rdi # sched: [2:1.00]
-; BROADWELL-NEXT:    rorq %rdi # sched: [2:1.00]
-; BROADWELL-NEXT:    rolq (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rorq (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rolq $7, %rdi # sched: [2:1.00]
-; BROADWELL-NEXT:    rorq $7, %rdi # sched: [2:1.00]
-; BROADWELL-NEXT:    rolq $7, (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rorq $7, (%rdx) # sched: [7:1.00]
-; BROADWELL-NEXT:    rolq %cl, %rdi # sched: [3:1.00]
-; BROADWELL-NEXT:    rorq %cl, %rdi # sched: [3:1.00]
-; BROADWELL-NEXT:    rolq %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    rorq %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rclq %rdi # sched: [3:0.75]
+; BROADWELL-NEXT:    rcrq %rdi # sched: [3:0.75]
+; BROADWELL-NEXT:    rclq (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcrq (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rclq $7, %rdi # sched: [3:0.75]
+; BROADWELL-NEXT:    rcrq $7, %rdi # sched: [3:0.75]
+; BROADWELL-NEXT:    rclq $7, (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rcrq $7, (%rdx) # sched: [8:0.75]
+; BROADWELL-NEXT:    rclq %cl, %rdi # sched: [11:2.00]
+; BROADWELL-NEXT:    rcrq %cl, %rdi # sched: [11:2.00]
+; BROADWELL-NEXT:    rclq %cl, (%rdx) # sched: [15:2.00]
+; BROADWELL-NEXT:    rcrq %cl, (%rdx) # sched: [18:2.25]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_rol_ror_64:
+; SKYLAKE-LABEL: test_rcl_rcr_64:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    rolq %rdi # sched: [2:1.00]
-; SKYLAKE-NEXT:    rorq %rdi # sched: [2:1.00]
-; SKYLAKE-NEXT:    rolq (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rorq (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rolq $7, %rdi # sched: [2:1.00]
-; SKYLAKE-NEXT:    rorq $7, %rdi # sched: [2:1.00]
-; SKYLAKE-NEXT:    rolq $7, (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rorq $7, (%rdx) # sched: [7:1.00]
-; SKYLAKE-NEXT:    rolq %cl, %rdi # sched: [3:1.50]
-; SKYLAKE-NEXT:    rorq %cl, %rdi # sched: [3:1.50]
-; SKYLAKE-NEXT:    rolq %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    rorq %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rclq %rdi # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcrq %rdi # sched: [3:0.75]
+; SKYLAKE-NEXT:    rclq (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcrq (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rclq $7, %rdi # sched: [3:0.75]
+; SKYLAKE-NEXT:    rcrq $7, %rdi # sched: [3:0.75]
+; SKYLAKE-NEXT:    rclq $7, (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rcrq $7, (%rdx) # sched: [8:0.75]
+; SKYLAKE-NEXT:    rclq %cl, %rdi # sched: [11:2.00]
+; SKYLAKE-NEXT:    rcrq %cl, %rdi # sched: [11:2.00]
+; SKYLAKE-NEXT:    rclq %cl, (%rdx) # sched: [15:2.50]
+; SKYLAKE-NEXT:    rcrq %cl, (%rdx) # sched: [18:2.25]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_rol_ror_64:
+; SKX-LABEL: test_rcl_rcr_64:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    rolq %rdi # sched: [2:1.00]
-; SKX-NEXT:    rorq %rdi # sched: [2:1.00]
-; SKX-NEXT:    rolq (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rorq (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rolq $7, %rdi # sched: [2:1.00]
-; SKX-NEXT:    rorq $7, %rdi # sched: [2:1.00]
-; SKX-NEXT:    rolq $7, (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rorq $7, (%rdx) # sched: [7:1.00]
-; SKX-NEXT:    rolq %cl, %rdi # sched: [3:1.50]
-; SKX-NEXT:    rorq %cl, %rdi # sched: [3:1.50]
-; SKX-NEXT:    rolq %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    rorq %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rclq %rdi # sched: [3:0.75]
+; SKX-NEXT:    rcrq %rdi # sched: [3:0.75]
+; SKX-NEXT:    rclq (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcrq (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rclq $7, %rdi # sched: [3:0.75]
+; SKX-NEXT:    rcrq $7, %rdi # sched: [3:0.75]
+; SKX-NEXT:    rclq $7, (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rcrq $7, (%rdx) # sched: [8:0.75]
+; SKX-NEXT:    rclq %cl, %rdi # sched: [11:2.00]
+; SKX-NEXT:    rcrq %cl, %rdi # sched: [11:2.00]
+; SKX-NEXT:    rclq %cl, (%rdx) # sched: [15:2.50]
+; SKX-NEXT:    rcrq %cl, (%rdx) # sched: [18:2.25]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_rol_ror_64:
+; BTVER2-LABEL: test_rcl_rcr_64:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    rolq %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rorq %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rolq (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorq (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rolq $7, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rorq $7, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rolq $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorq $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rolq %cl, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rorq %cl, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    rolq %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    rorq %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rclq %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rcrq %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rclq (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrq (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rclq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rcrq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rclq $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrq $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rclq %cl, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rcrq %cl, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rclq %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rcrq %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_rol_ror_64:
+; ZNVER1-LABEL: test_rcl_rcr_64:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    rolq %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rorq %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rolq (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorq (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rolq $7, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rorq $7, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rolq $7, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorq $7, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rolq %cl, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rorq %cl, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    rolq %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    rorq %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rclq %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrq %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rclq (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrq (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rclq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rclq $7, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrq $7, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rclq %cl, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rcrq %cl, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rclq %cl, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    rcrq %cl, (%rdx) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "rolq $0 \0A\09 rorq $0 \0A\09 rolq $2 \0A\09 rorq $2 \0A\09 rolq $3, $0 \0A\09 rorq $3, $0 \0A\09 rolq $3, $2 \0A\09 rorq $3, $2 \0A\09 rolq %CL, $0 \0A\09 rorq %CL, $0 \0A\09 rolq %CL, $2 \0A\09 rorq %CL, $2", "r,r,*m,i"(i64 %a0, i64 %a1, i64 *%a2, i8 7)
+  call void asm sideeffect "rclq $0 \0A\09 rcrq $0 \0A\09 rclq $2 \0A\09 rcrq $2 \0A\09 rclq $3, $0 \0A\09 rcrq $3, $0 \0A\09 rclq $3, $2 \0A\09 rcrq $3, $2 \0A\09 rclq %CL, $0 \0A\09 rcrq %CL, $0 \0A\09 rclq %CL, $2 \0A\09 rcrq %CL, $2", "r,r,*m,i"(i64 %a0, i64 %a1, i64 *%a2, i8 7)
   ret void
 }
 
-define void @test_sar_shl_shr_8(i8 %a0, i8 %a1, i8 *%a2) optsize {
-; GENERIC-LABEL: test_sar_shl_shr_8:
+; TODO - test_ret
+
+define void @test_rol_ror_8(i8 %a0, i8 %a1, i8 *%a2) optsize {
+; GENERIC-LABEL: test_rol_ror_8:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    sarb %dil # sched: [1:0.50]
-; GENERIC-NEXT:    shlb %dil # sched: [1:0.50]
-; GENERIC-NEXT:    shrb %dil # sched: [1:0.50]
-; GENERIC-NEXT:    sarb (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    shlb (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shrb (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    sarb $7, %dil # sched: [1:0.50]
-; GENERIC-NEXT:    shlb $7, %dil # sched: [1:0.50]
-; GENERIC-NEXT:    shrb $7, %dil # sched: [1:0.50]
-; GENERIC-NEXT:    sarb $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shlb $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shrb $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    sarb %cl, %dil # sched: [3:1.50]
-; GENERIC-NEXT:    shlb %cl, %dil # sched: [3:1.50]
-; GENERIC-NEXT:    shrb %cl, %dil # sched: [3:1.50]
-; GENERIC-NEXT:    sarb %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    shlb %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    shrb %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rolb %dil # sched: [1:0.50]
+; GENERIC-NEXT:    rorb %dil # sched: [1:0.50]
+; GENERIC-NEXT:    rolb (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rorb (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rolb $7, %dil # sched: [2:1.00]
+; GENERIC-NEXT:    rorb $7, %dil # sched: [2:1.00]
+; GENERIC-NEXT:    rolb $7, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    rorb $7, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    rolb %cl, %dil # sched: [3:1.50]
+; GENERIC-NEXT:    rorb %cl, %dil # sched: [3:1.50]
+; GENERIC-NEXT:    rolb %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rorb %cl, (%rdx) # sched: [9:1.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sar_shl_shr_8:
+; ATOM-LABEL: test_rol_ror_8:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    sarb %dil # sched: [1:1.00]
-; ATOM-NEXT:    shlb %dil # sched: [1:1.00]
-; ATOM-NEXT:    shrb %dil # sched: [1:1.00]
-; ATOM-NEXT:    sarb (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shlb (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrb (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    sarb $7, %dil # sched: [1:1.00]
-; ATOM-NEXT:    shlb $7, %dil # sched: [1:1.00]
-; ATOM-NEXT:    shrb $7, %dil # sched: [1:1.00]
-; ATOM-NEXT:    sarb $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shlb $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrb $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    sarb %cl, %dil # sched: [1:1.00]
-; ATOM-NEXT:    shlb %cl, %dil # sched: [1:1.00]
-; ATOM-NEXT:    shrb %cl, %dil # sched: [1:1.00]
-; ATOM-NEXT:    sarb %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shlb %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrb %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rolb %dil # sched: [1:1.00]
+; ATOM-NEXT:    rorb %dil # sched: [1:1.00]
+; ATOM-NEXT:    rolb (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorb (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rolb $7, %dil # sched: [1:1.00]
+; ATOM-NEXT:    rorb $7, %dil # sched: [1:1.00]
+; ATOM-NEXT:    rolb $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorb $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rolb %cl, %dil # sched: [1:1.00]
+; ATOM-NEXT:    rorb %cl, %dil # sched: [1:1.00]
+; ATOM-NEXT:    rolb %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorb %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sar_shl_shr_8:
+; SLM-LABEL: test_rol_ror_8:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    sarb %dil # sched: [1:1.00]
-; SLM-NEXT:    shlb %dil # sched: [1:1.00]
-; SLM-NEXT:    shrb %dil # sched: [1:1.00]
-; SLM-NEXT:    sarb (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shlb (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrb (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    sarb $7, %dil # sched: [1:1.00]
-; SLM-NEXT:    shlb $7, %dil # sched: [1:1.00]
-; SLM-NEXT:    shrb $7, %dil # sched: [1:1.00]
-; SLM-NEXT:    sarb $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shlb $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrb $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    sarb %cl, %dil # sched: [1:1.00]
-; SLM-NEXT:    shlb %cl, %dil # sched: [1:1.00]
-; SLM-NEXT:    shrb %cl, %dil # sched: [1:1.00]
-; SLM-NEXT:    sarb %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shlb %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrb %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rolb %dil # sched: [1:1.00]
+; SLM-NEXT:    rorb %dil # sched: [1:1.00]
+; SLM-NEXT:    rolb (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorb (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rolb $7, %dil # sched: [1:1.00]
+; SLM-NEXT:    rorb $7, %dil # sched: [1:1.00]
+; SLM-NEXT:    rolb $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorb $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rolb %cl, %dil # sched: [1:1.00]
+; SLM-NEXT:    rorb %cl, %dil # sched: [1:1.00]
+; SLM-NEXT:    rolb %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorb %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sar_shl_shr_8:
+; SANDY-LABEL: test_rol_ror_8:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    sarb %dil # sched: [1:0.50]
-; SANDY-NEXT:    shlb %dil # sched: [1:0.50]
-; SANDY-NEXT:    shrb %dil # sched: [1:0.50]
-; SANDY-NEXT:    sarb (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    shlb (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shrb (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    sarb $7, %dil # sched: [1:0.50]
-; SANDY-NEXT:    shlb $7, %dil # sched: [1:0.50]
-; SANDY-NEXT:    shrb $7, %dil # sched: [1:0.50]
-; SANDY-NEXT:    sarb $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shlb $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shrb $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    sarb %cl, %dil # sched: [3:1.50]
-; SANDY-NEXT:    shlb %cl, %dil # sched: [3:1.50]
-; SANDY-NEXT:    shrb %cl, %dil # sched: [3:1.50]
-; SANDY-NEXT:    sarb %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    shlb %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    shrb %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rolb %dil # sched: [1:0.50]
+; SANDY-NEXT:    rorb %dil # sched: [1:0.50]
+; SANDY-NEXT:    rolb (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rorb (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rolb $7, %dil # sched: [2:1.00]
+; SANDY-NEXT:    rorb $7, %dil # sched: [2:1.00]
+; SANDY-NEXT:    rolb $7, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    rorb $7, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    rolb %cl, %dil # sched: [3:1.50]
+; SANDY-NEXT:    rorb %cl, %dil # sched: [3:1.50]
+; SANDY-NEXT:    rolb %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rorb %cl, (%rdx) # sched: [9:1.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sar_shl_shr_8:
+; HASWELL-LABEL: test_rol_ror_8:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    sarb %dil # sched: [1:0.50]
-; HASWELL-NEXT:    shlb %dil # sched: [1:0.50]
-; HASWELL-NEXT:    shrb %dil # sched: [1:0.50]
-; HASWELL-NEXT:    sarb (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shlb (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shrb (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    sarb $7, %dil # sched: [1:0.50]
-; HASWELL-NEXT:    shlb $7, %dil # sched: [1:0.50]
-; HASWELL-NEXT:    shrb $7, %dil # sched: [1:0.50]
-; HASWELL-NEXT:    sarb $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shlb $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shrb $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    sarb %cl, %dil # sched: [3:1.00]
-; HASWELL-NEXT:    shlb %cl, %dil # sched: [3:1.00]
-; HASWELL-NEXT:    shrb %cl, %dil # sched: [3:1.00]
-; HASWELL-NEXT:    sarb %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    shlb %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    shrb %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rolb %dil # sched: [2:1.00]
+; HASWELL-NEXT:    rorb %dil # sched: [2:1.00]
+; HASWELL-NEXT:    rolb (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rorb (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rolb $7, %dil # sched: [2:1.00]
+; HASWELL-NEXT:    rorb $7, %dil # sched: [2:1.00]
+; HASWELL-NEXT:    rolb $7, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rorb $7, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rolb %cl, %dil # sched: [3:1.00]
+; HASWELL-NEXT:    rorb %cl, %dil # sched: [3:1.00]
+; HASWELL-NEXT:    rolb %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rorb %cl, (%rdx) # sched: [9:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sar_shl_shr_8:
+; BROADWELL-LABEL: test_rol_ror_8:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    sarb %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    shlb %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    shrb %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    sarb (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shlb (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shrb (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    sarb $7, %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    shlb $7, %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    shrb $7, %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    sarb $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shlb $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shrb $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    sarb %cl, %dil # sched: [3:1.00]
-; BROADWELL-NEXT:    shlb %cl, %dil # sched: [3:1.00]
-; BROADWELL-NEXT:    shrb %cl, %dil # sched: [3:1.00]
-; BROADWELL-NEXT:    sarb %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    shlb %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    shrb %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rolb %dil # sched: [2:1.00]
+; BROADWELL-NEXT:    rorb %dil # sched: [2:1.00]
+; BROADWELL-NEXT:    rolb (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rorb (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rolb $7, %dil # sched: [2:1.00]
+; BROADWELL-NEXT:    rorb $7, %dil # sched: [2:1.00]
+; BROADWELL-NEXT:    rolb $7, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rorb $7, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rolb %cl, %dil # sched: [3:1.00]
+; BROADWELL-NEXT:    rorb %cl, %dil # sched: [3:1.00]
+; BROADWELL-NEXT:    rolb %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rorb %cl, (%rdx) # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sar_shl_shr_8:
+; SKYLAKE-LABEL: test_rol_ror_8:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    sarb %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    shlb %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    shrb %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    sarb (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shlb (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrb (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    sarb $7, %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    shlb $7, %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    shrb $7, %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    sarb $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shlb $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrb $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    sarb %cl, %dil # sched: [3:1.50]
-; SKYLAKE-NEXT:    shlb %cl, %dil # sched: [3:1.50]
-; SKYLAKE-NEXT:    shrb %cl, %dil # sched: [3:1.50]
-; SKYLAKE-NEXT:    sarb %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    shlb %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    shrb %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rolb %dil # sched: [2:1.00]
+; SKYLAKE-NEXT:    rorb %dil # sched: [2:1.00]
+; SKYLAKE-NEXT:    rolb (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rorb (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rolb $7, %dil # sched: [2:1.00]
+; SKYLAKE-NEXT:    rorb $7, %dil # sched: [2:1.00]
+; SKYLAKE-NEXT:    rolb $7, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rorb $7, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rolb %cl, %dil # sched: [3:1.50]
+; SKYLAKE-NEXT:    rorb %cl, %dil # sched: [3:1.50]
+; SKYLAKE-NEXT:    rolb %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rorb %cl, (%rdx) # sched: [8:1.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sar_shl_shr_8:
+; SKX-LABEL: test_rol_ror_8:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    sarb %dil # sched: [1:0.50]
-; SKX-NEXT:    shlb %dil # sched: [1:0.50]
-; SKX-NEXT:    shrb %dil # sched: [1:0.50]
-; SKX-NEXT:    sarb (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shlb (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shrb (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    sarb $7, %dil # sched: [1:0.50]
-; SKX-NEXT:    shlb $7, %dil # sched: [1:0.50]
-; SKX-NEXT:    shrb $7, %dil # sched: [1:0.50]
-; SKX-NEXT:    sarb $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shlb $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shrb $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    sarb %cl, %dil # sched: [3:1.50]
-; SKX-NEXT:    shlb %cl, %dil # sched: [3:1.50]
-; SKX-NEXT:    shrb %cl, %dil # sched: [3:1.50]
-; SKX-NEXT:    sarb %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    shlb %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    shrb %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rolb %dil # sched: [2:1.00]
+; SKX-NEXT:    rorb %dil # sched: [2:1.00]
+; SKX-NEXT:    rolb (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rorb (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rolb $7, %dil # sched: [2:1.00]
+; SKX-NEXT:    rorb $7, %dil # sched: [2:1.00]
+; SKX-NEXT:    rolb $7, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rorb $7, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rolb %cl, %dil # sched: [3:1.50]
+; SKX-NEXT:    rorb %cl, %dil # sched: [3:1.50]
+; SKX-NEXT:    rolb %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rorb %cl, (%rdx) # sched: [8:1.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sar_shl_shr_8:
+; BTVER2-LABEL: test_rol_ror_8:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    sarb %dil # sched: [1:0.50]
-; BTVER2-NEXT:    shlb %dil # sched: [1:0.50]
-; BTVER2-NEXT:    shrb %dil # sched: [1:0.50]
-; BTVER2-NEXT:    sarb (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shlb (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrb (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    sarb $7, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    shlb $7, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    shrb $7, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    sarb $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shlb $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrb $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    sarb %cl, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    shlb %cl, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    shrb %cl, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    sarb %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shlb %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrb %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rolb %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rorb %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rolb (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorb (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rolb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rorb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rolb $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorb $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rolb %cl, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rorb %cl, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    rolb %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorb %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sar_shl_shr_8:
+; ZNVER1-LABEL: test_rol_ror_8:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    sarb %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    shlb %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    shrb %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    sarb (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shlb (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrb (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    sarb $7, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    shlb $7, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    shrb $7, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    sarb $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shlb $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrb $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    sarb %cl, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    shlb %cl, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    shrb %cl, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    sarb %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    shlb %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    shrb %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rolb %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rorb %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rolb (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorb (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rolb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rorb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rolb $7, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorb $7, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rolb %cl, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rorb %cl, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    rolb %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorb %cl, (%rdx) # sched: [5:1.00]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "sarb $0 \0A\09 shlb $0 \0A\09 shrb $0 \0A\09 sarb $2 \0A\09 shlb $2 \0A\09 shrb $2 \0A\09 sarb $3, $0 \0A\09 shlb $3, $0 \0A\09 shrb $3, $0 \0A\09 sarb $3, $2 \0A\09 shlb $3, $2 \0A\09 shrb $3, $2 \0A\09 sarb %CL, $0 \0A\09 shlb %CL, $0 \0A\09 shrb %CL, $0 \0A\09 sarb %CL, $2  \0A\09 shlb %CL, $2 \0A\09 shrb %CL, $2", "r,r,*m,i"(i8 %a0, i8 %a1, i8 *%a2, i8 7)
+  call void asm sideeffect "rolb $0 \0A\09 rorb $0 \0A\09 rolb $2 \0A\09 rorb $2 \0A\09 rolb $3, $0 \0A\09 rorb $3, $0 \0A\09 rolb $3, $2 \0A\09 rorb $3, $2 \0A\09 rolb %CL, $0 \0A\09 rorb %CL, $0 \0A\09 rolb %CL, $2 \0A\09 rorb %CL, $2", "r,r,*m,i"(i8 %a0, i8 %a1, i8 *%a2, i8 7)
   ret void
 }
-define void @test_sar_shl_shr_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
-; GENERIC-LABEL: test_sar_shl_shr_16:
+define void @test_rol_ror_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
+; GENERIC-LABEL: test_rol_ror_16:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    sarw %di # sched: [1:0.50]
-; GENERIC-NEXT:    shlw %di # sched: [1:0.50]
-; GENERIC-NEXT:    shrw %di # sched: [1:0.50]
-; GENERIC-NEXT:    sarw (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    shlw (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shrw (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    sarw $7, %di # sched: [1:0.50]
-; GENERIC-NEXT:    shlw $7, %di # sched: [1:0.50]
-; GENERIC-NEXT:    shrw $7, %di # sched: [1:0.50]
-; GENERIC-NEXT:    sarw $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shlw $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shrw $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    sarw %cl, %di # sched: [3:1.50]
-; GENERIC-NEXT:    shlw %cl, %di # sched: [3:1.50]
-; GENERIC-NEXT:    shrw %cl, %di # sched: [3:1.50]
-; GENERIC-NEXT:    sarw %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    shlw %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    shrw %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rolw %di # sched: [1:0.50]
+; GENERIC-NEXT:    rorw %di # sched: [1:0.50]
+; GENERIC-NEXT:    rolw (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rorw (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rolw $7, %di # sched: [2:1.00]
+; GENERIC-NEXT:    rorw $7, %di # sched: [2:1.00]
+; GENERIC-NEXT:    rolw $7, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    rorw $7, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    rolw %cl, %di # sched: [3:1.50]
+; GENERIC-NEXT:    rorw %cl, %di # sched: [3:1.50]
+; GENERIC-NEXT:    rolw %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rorw %cl, (%rdx) # sched: [9:1.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sar_shl_shr_16:
+; ATOM-LABEL: test_rol_ror_16:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    sarw %di # sched: [1:1.00]
-; ATOM-NEXT:    shlw %di # sched: [1:1.00]
-; ATOM-NEXT:    shrw %di # sched: [1:1.00]
-; ATOM-NEXT:    sarw (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shlw (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrw (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    sarw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    shlw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    shrw $7, %di # sched: [1:1.00]
-; ATOM-NEXT:    sarw $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shlw $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrw $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    sarw %cl, %di # sched: [1:1.00]
-; ATOM-NEXT:    shlw %cl, %di # sched: [1:1.00]
-; ATOM-NEXT:    shrw %cl, %di # sched: [1:1.00]
-; ATOM-NEXT:    sarw %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shlw %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrw %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rolw %di # sched: [1:1.00]
+; ATOM-NEXT:    rorw %di # sched: [1:1.00]
+; ATOM-NEXT:    rolw (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorw (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rolw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    rorw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    rolw $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorw $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rolw %cl, %di # sched: [1:1.00]
+; ATOM-NEXT:    rorw %cl, %di # sched: [1:1.00]
+; ATOM-NEXT:    rolw %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorw %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sar_shl_shr_16:
+; SLM-LABEL: test_rol_ror_16:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    sarw %di # sched: [1:1.00]
-; SLM-NEXT:    shlw %di # sched: [1:1.00]
-; SLM-NEXT:    shrw %di # sched: [1:1.00]
-; SLM-NEXT:    sarw (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shlw (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrw (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    sarw $7, %di # sched: [1:1.00]
-; SLM-NEXT:    shlw $7, %di # sched: [1:1.00]
-; SLM-NEXT:    shrw $7, %di # sched: [1:1.00]
-; SLM-NEXT:    sarw $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shlw $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrw $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    sarw %cl, %di # sched: [1:1.00]
-; SLM-NEXT:    shlw %cl, %di # sched: [1:1.00]
-; SLM-NEXT:    shrw %cl, %di # sched: [1:1.00]
-; SLM-NEXT:    sarw %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shlw %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrw %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rolw %di # sched: [1:1.00]
+; SLM-NEXT:    rorw %di # sched: [1:1.00]
+; SLM-NEXT:    rolw (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorw (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rolw $7, %di # sched: [1:1.00]
+; SLM-NEXT:    rorw $7, %di # sched: [1:1.00]
+; SLM-NEXT:    rolw $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorw $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rolw %cl, %di # sched: [1:1.00]
+; SLM-NEXT:    rorw %cl, %di # sched: [1:1.00]
+; SLM-NEXT:    rolw %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorw %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sar_shl_shr_16:
+; SANDY-LABEL: test_rol_ror_16:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    sarw %di # sched: [1:0.50]
-; SANDY-NEXT:    shlw %di # sched: [1:0.50]
-; SANDY-NEXT:    shrw %di # sched: [1:0.50]
-; SANDY-NEXT:    sarw (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    shlw (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shrw (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    sarw $7, %di # sched: [1:0.50]
-; SANDY-NEXT:    shlw $7, %di # sched: [1:0.50]
-; SANDY-NEXT:    shrw $7, %di # sched: [1:0.50]
-; SANDY-NEXT:    sarw $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shlw $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shrw $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    sarw %cl, %di # sched: [3:1.50]
-; SANDY-NEXT:    shlw %cl, %di # sched: [3:1.50]
-; SANDY-NEXT:    shrw %cl, %di # sched: [3:1.50]
-; SANDY-NEXT:    sarw %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    shlw %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    shrw %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rolw %di # sched: [1:0.50]
+; SANDY-NEXT:    rorw %di # sched: [1:0.50]
+; SANDY-NEXT:    rolw (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rorw (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rolw $7, %di # sched: [2:1.00]
+; SANDY-NEXT:    rorw $7, %di # sched: [2:1.00]
+; SANDY-NEXT:    rolw $7, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    rorw $7, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    rolw %cl, %di # sched: [3:1.50]
+; SANDY-NEXT:    rorw %cl, %di # sched: [3:1.50]
+; SANDY-NEXT:    rolw %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rorw %cl, (%rdx) # sched: [9:1.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sar_shl_shr_16:
+; HASWELL-LABEL: test_rol_ror_16:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    sarw %di # sched: [1:0.50]
-; HASWELL-NEXT:    shlw %di # sched: [1:0.50]
-; HASWELL-NEXT:    shrw %di # sched: [1:0.50]
-; HASWELL-NEXT:    sarw (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shlw (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shrw (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    sarw $7, %di # sched: [1:0.50]
-; HASWELL-NEXT:    shlw $7, %di # sched: [1:0.50]
-; HASWELL-NEXT:    shrw $7, %di # sched: [1:0.50]
-; HASWELL-NEXT:    sarw $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shlw $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shrw $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    sarw %cl, %di # sched: [3:1.00]
-; HASWELL-NEXT:    shlw %cl, %di # sched: [3:1.00]
-; HASWELL-NEXT:    shrw %cl, %di # sched: [3:1.00]
-; HASWELL-NEXT:    sarw %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    shlw %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    shrw %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rolw %di # sched: [2:1.00]
+; HASWELL-NEXT:    rorw %di # sched: [2:1.00]
+; HASWELL-NEXT:    rolw (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rorw (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rolw $7, %di # sched: [2:1.00]
+; HASWELL-NEXT:    rorw $7, %di # sched: [2:1.00]
+; HASWELL-NEXT:    rolw $7, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rorw $7, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rolw %cl, %di # sched: [3:1.00]
+; HASWELL-NEXT:    rorw %cl, %di # sched: [3:1.00]
+; HASWELL-NEXT:    rolw %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rorw %cl, (%rdx) # sched: [9:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sar_shl_shr_16:
+; BROADWELL-LABEL: test_rol_ror_16:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    sarw %di # sched: [1:0.50]
-; BROADWELL-NEXT:    shlw %di # sched: [1:0.50]
-; BROADWELL-NEXT:    shrw %di # sched: [1:0.50]
-; BROADWELL-NEXT:    sarw (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shlw (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shrw (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    sarw $7, %di # sched: [1:0.50]
-; BROADWELL-NEXT:    shlw $7, %di # sched: [1:0.50]
-; BROADWELL-NEXT:    shrw $7, %di # sched: [1:0.50]
-; BROADWELL-NEXT:    sarw $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shlw $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shrw $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    sarw %cl, %di # sched: [3:1.00]
-; BROADWELL-NEXT:    shlw %cl, %di # sched: [3:1.00]
-; BROADWELL-NEXT:    shrw %cl, %di # sched: [3:1.00]
-; BROADWELL-NEXT:    sarw %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    shlw %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    shrw %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rolw %di # sched: [2:1.00]
+; BROADWELL-NEXT:    rorw %di # sched: [2:1.00]
+; BROADWELL-NEXT:    rolw (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rorw (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rolw $7, %di # sched: [2:1.00]
+; BROADWELL-NEXT:    rorw $7, %di # sched: [2:1.00]
+; BROADWELL-NEXT:    rolw $7, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rorw $7, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rolw %cl, %di # sched: [3:1.00]
+; BROADWELL-NEXT:    rorw %cl, %di # sched: [3:1.00]
+; BROADWELL-NEXT:    rolw %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rorw %cl, (%rdx) # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sar_shl_shr_16:
+; SKYLAKE-LABEL: test_rol_ror_16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    sarw %di # sched: [1:0.50]
-; SKYLAKE-NEXT:    shlw %di # sched: [1:0.50]
-; SKYLAKE-NEXT:    shrw %di # sched: [1:0.50]
-; SKYLAKE-NEXT:    sarw (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shlw (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrw (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    sarw $7, %di # sched: [1:0.50]
-; SKYLAKE-NEXT:    shlw $7, %di # sched: [1:0.50]
-; SKYLAKE-NEXT:    shrw $7, %di # sched: [1:0.50]
-; SKYLAKE-NEXT:    sarw $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shlw $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrw $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    sarw %cl, %di # sched: [3:1.50]
-; SKYLAKE-NEXT:    shlw %cl, %di # sched: [3:1.50]
-; SKYLAKE-NEXT:    shrw %cl, %di # sched: [3:1.50]
-; SKYLAKE-NEXT:    sarw %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    shlw %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    shrw %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rolw %di # sched: [2:1.00]
+; SKYLAKE-NEXT:    rorw %di # sched: [2:1.00]
+; SKYLAKE-NEXT:    rolw (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rorw (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rolw $7, %di # sched: [2:1.00]
+; SKYLAKE-NEXT:    rorw $7, %di # sched: [2:1.00]
+; SKYLAKE-NEXT:    rolw $7, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rorw $7, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rolw %cl, %di # sched: [3:1.50]
+; SKYLAKE-NEXT:    rorw %cl, %di # sched: [3:1.50]
+; SKYLAKE-NEXT:    rolw %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rorw %cl, (%rdx) # sched: [8:1.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sar_shl_shr_16:
+; SKX-LABEL: test_rol_ror_16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    sarw %di # sched: [1:0.50]
-; SKX-NEXT:    shlw %di # sched: [1:0.50]
-; SKX-NEXT:    shrw %di # sched: [1:0.50]
-; SKX-NEXT:    sarw (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shlw (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shrw (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    sarw $7, %di # sched: [1:0.50]
-; SKX-NEXT:    shlw $7, %di # sched: [1:0.50]
-; SKX-NEXT:    shrw $7, %di # sched: [1:0.50]
-; SKX-NEXT:    sarw $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shlw $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shrw $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    sarw %cl, %di # sched: [3:1.50]
-; SKX-NEXT:    shlw %cl, %di # sched: [3:1.50]
-; SKX-NEXT:    shrw %cl, %di # sched: [3:1.50]
-; SKX-NEXT:    sarw %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    shlw %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    shrw %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rolw %di # sched: [2:1.00]
+; SKX-NEXT:    rorw %di # sched: [2:1.00]
+; SKX-NEXT:    rolw (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rorw (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rolw $7, %di # sched: [2:1.00]
+; SKX-NEXT:    rorw $7, %di # sched: [2:1.00]
+; SKX-NEXT:    rolw $7, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rorw $7, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rolw %cl, %di # sched: [3:1.50]
+; SKX-NEXT:    rorw %cl, %di # sched: [3:1.50]
+; SKX-NEXT:    rolw %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rorw %cl, (%rdx) # sched: [8:1.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sar_shl_shr_16:
+; BTVER2-LABEL: test_rol_ror_16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    sarw %di # sched: [1:0.50]
-; BTVER2-NEXT:    shlw %di # sched: [1:0.50]
-; BTVER2-NEXT:    shrw %di # sched: [1:0.50]
-; BTVER2-NEXT:    sarw (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shlw (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrw (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    sarw $7, %di # sched: [1:0.50]
-; BTVER2-NEXT:    shlw $7, %di # sched: [1:0.50]
-; BTVER2-NEXT:    shrw $7, %di # sched: [1:0.50]
-; BTVER2-NEXT:    sarw $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shlw $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrw $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    sarw %cl, %di # sched: [1:0.50]
-; BTVER2-NEXT:    shlw %cl, %di # sched: [1:0.50]
-; BTVER2-NEXT:    shrw %cl, %di # sched: [1:0.50]
-; BTVER2-NEXT:    sarw %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shlw %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrw %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rolw %di # sched: [1:0.50]
+; BTVER2-NEXT:    rorw %di # sched: [1:0.50]
+; BTVER2-NEXT:    rolw (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorw (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rolw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    rorw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    rolw $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorw $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rolw %cl, %di # sched: [1:0.50]
+; BTVER2-NEXT:    rorw %cl, %di # sched: [1:0.50]
+; BTVER2-NEXT:    rolw %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorw %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sar_shl_shr_16:
+; ZNVER1-LABEL: test_rol_ror_16:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    sarw %di # sched: [1:0.25]
-; ZNVER1-NEXT:    shlw %di # sched: [1:0.25]
-; ZNVER1-NEXT:    shrw %di # sched: [1:0.25]
-; ZNVER1-NEXT:    sarw (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shlw (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrw (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    sarw $7, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    shlw $7, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    shrw $7, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    sarw $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shlw $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrw $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    sarw %cl, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    shlw %cl, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    shrw %cl, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    sarw %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    shlw %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    shrw %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rolw %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rorw %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rolw (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorw (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rolw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rorw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rolw $7, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorw $7, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rolw %cl, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rorw %cl, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    rolw %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorw %cl, (%rdx) # sched: [5:1.00]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "sarw $0 \0A\09 shlw $0 \0A\09 shrw $0 \0A\09 sarw $2 \0A\09 shlw $2 \0A\09 shrw $2 \0A\09 sarw $3, $0 \0A\09 shlw $3, $0 \0A\09 shrw $3, $0 \0A\09 sarw $3, $2 \0A\09 shlw $3, $2 \0A\09 shrw $3, $2 \0A\09 sarw %CL, $0 \0A\09 shlw %CL, $0 \0A\09 shrw %CL, $0 \0A\09 sarw %CL, $2  \0A\09 shlw %CL, $2 \0A\09 shrw %CL, $2", "r,r,*m,i"(i16 %a0, i16 %a1, i16 *%a2, i8 7)
+  call void asm sideeffect "rolw $0 \0A\09 rorw $0 \0A\09 rolw $2 \0A\09 rorw $2 \0A\09 rolw $3, $0 \0A\09 rorw $3, $0 \0A\09 rolw $3, $2 \0A\09 rorw $3, $2 \0A\09 rolw %CL, $0 \0A\09 rorw %CL, $0 \0A\09 rolw %CL, $2 \0A\09 rorw %CL, $2", "r,r,*m,i"(i16 %a0, i16 %a1, i16 *%a2, i8 7)
   ret void
 }
-define void @test_sar_shl_shr_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
-; GENERIC-LABEL: test_sar_shl_shr_32:
+define void @test_rol_ror_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
+; GENERIC-LABEL: test_rol_ror_32:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    sarl %edi # sched: [1:0.50]
-; GENERIC-NEXT:    shll %edi # sched: [1:0.50]
-; GENERIC-NEXT:    shrl %edi # sched: [1:0.50]
-; GENERIC-NEXT:    sarl (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    shll (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shrl (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    sarl $7, %edi # sched: [1:0.50]
-; GENERIC-NEXT:    shll $7, %edi # sched: [1:0.50]
-; GENERIC-NEXT:    shrl $7, %edi # sched: [1:0.50]
-; GENERIC-NEXT:    sarl $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shll $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shrl $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    sarl %cl, %edi # sched: [3:1.50]
-; GENERIC-NEXT:    shll %cl, %edi # sched: [3:1.50]
-; GENERIC-NEXT:    shrl %cl, %edi # sched: [3:1.50]
-; GENERIC-NEXT:    sarl %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    shll %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    shrl %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    roll %edi # sched: [1:0.50]
+; GENERIC-NEXT:    rorl %edi # sched: [1:0.50]
+; GENERIC-NEXT:    roll (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rorl (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    roll $7, %edi # sched: [2:1.00]
+; GENERIC-NEXT:    rorl $7, %edi # sched: [2:1.00]
+; GENERIC-NEXT:    roll $7, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    rorl $7, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    roll %cl, %edi # sched: [3:1.50]
+; GENERIC-NEXT:    rorl %cl, %edi # sched: [3:1.50]
+; GENERIC-NEXT:    roll %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rorl %cl, (%rdx) # sched: [9:1.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sar_shl_shr_32:
+; ATOM-LABEL: test_rol_ror_32:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    sarl %edi # sched: [1:1.00]
-; ATOM-NEXT:    shll %edi # sched: [1:1.00]
-; ATOM-NEXT:    shrl %edi # sched: [1:1.00]
-; ATOM-NEXT:    sarl (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shll (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrl (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    sarl $7, %edi # sched: [1:1.00]
-; ATOM-NEXT:    shll $7, %edi # sched: [1:1.00]
-; ATOM-NEXT:    shrl $7, %edi # sched: [1:1.00]
-; ATOM-NEXT:    sarl $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shll $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrl $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    sarl %cl, %edi # sched: [1:1.00]
-; ATOM-NEXT:    shll %cl, %edi # sched: [1:1.00]
-; ATOM-NEXT:    shrl %cl, %edi # sched: [1:1.00]
-; ATOM-NEXT:    sarl %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shll %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrl %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    roll %edi # sched: [1:1.00]
+; ATOM-NEXT:    rorl %edi # sched: [1:1.00]
+; ATOM-NEXT:    roll (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorl (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    roll $7, %edi # sched: [1:1.00]
+; ATOM-NEXT:    rorl $7, %edi # sched: [1:1.00]
+; ATOM-NEXT:    roll $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorl $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    roll %cl, %edi # sched: [1:1.00]
+; ATOM-NEXT:    rorl %cl, %edi # sched: [1:1.00]
+; ATOM-NEXT:    roll %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorl %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sar_shl_shr_32:
+; SLM-LABEL: test_rol_ror_32:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    sarl %edi # sched: [1:1.00]
-; SLM-NEXT:    shll %edi # sched: [1:1.00]
-; SLM-NEXT:    shrl %edi # sched: [1:1.00]
-; SLM-NEXT:    sarl (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shll (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrl (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    sarl $7, %edi # sched: [1:1.00]
-; SLM-NEXT:    shll $7, %edi # sched: [1:1.00]
-; SLM-NEXT:    shrl $7, %edi # sched: [1:1.00]
-; SLM-NEXT:    sarl $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shll $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrl $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    sarl %cl, %edi # sched: [1:1.00]
-; SLM-NEXT:    shll %cl, %edi # sched: [1:1.00]
-; SLM-NEXT:    shrl %cl, %edi # sched: [1:1.00]
-; SLM-NEXT:    sarl %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shll %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrl %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    roll %edi # sched: [1:1.00]
+; SLM-NEXT:    rorl %edi # sched: [1:1.00]
+; SLM-NEXT:    roll (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorl (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    roll $7, %edi # sched: [1:1.00]
+; SLM-NEXT:    rorl $7, %edi # sched: [1:1.00]
+; SLM-NEXT:    roll $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorl $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    roll %cl, %edi # sched: [1:1.00]
+; SLM-NEXT:    rorl %cl, %edi # sched: [1:1.00]
+; SLM-NEXT:    roll %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorl %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sar_shl_shr_32:
+; SANDY-LABEL: test_rol_ror_32:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    sarl %edi # sched: [1:0.50]
-; SANDY-NEXT:    shll %edi # sched: [1:0.50]
-; SANDY-NEXT:    shrl %edi # sched: [1:0.50]
-; SANDY-NEXT:    sarl (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    shll (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shrl (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    sarl $7, %edi # sched: [1:0.50]
-; SANDY-NEXT:    shll $7, %edi # sched: [1:0.50]
-; SANDY-NEXT:    shrl $7, %edi # sched: [1:0.50]
-; SANDY-NEXT:    sarl $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shll $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shrl $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    sarl %cl, %edi # sched: [3:1.50]
-; SANDY-NEXT:    shll %cl, %edi # sched: [3:1.50]
-; SANDY-NEXT:    shrl %cl, %edi # sched: [3:1.50]
-; SANDY-NEXT:    sarl %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    shll %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    shrl %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    roll %edi # sched: [1:0.50]
+; SANDY-NEXT:    rorl %edi # sched: [1:0.50]
+; SANDY-NEXT:    roll (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rorl (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    roll $7, %edi # sched: [2:1.00]
+; SANDY-NEXT:    rorl $7, %edi # sched: [2:1.00]
+; SANDY-NEXT:    roll $7, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    rorl $7, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    roll %cl, %edi # sched: [3:1.50]
+; SANDY-NEXT:    rorl %cl, %edi # sched: [3:1.50]
+; SANDY-NEXT:    roll %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rorl %cl, (%rdx) # sched: [9:1.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sar_shl_shr_32:
+; HASWELL-LABEL: test_rol_ror_32:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    sarl %edi # sched: [1:0.50]
-; HASWELL-NEXT:    shll %edi # sched: [1:0.50]
-; HASWELL-NEXT:    shrl %edi # sched: [1:0.50]
-; HASWELL-NEXT:    sarl (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shll (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shrl (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    sarl $7, %edi # sched: [1:0.50]
-; HASWELL-NEXT:    shll $7, %edi # sched: [1:0.50]
-; HASWELL-NEXT:    shrl $7, %edi # sched: [1:0.50]
-; HASWELL-NEXT:    sarl $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shll $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shrl $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    sarl %cl, %edi # sched: [3:1.00]
-; HASWELL-NEXT:    shll %cl, %edi # sched: [3:1.00]
-; HASWELL-NEXT:    shrl %cl, %edi # sched: [3:1.00]
-; HASWELL-NEXT:    sarl %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    shll %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    shrl %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    roll %edi # sched: [2:1.00]
+; HASWELL-NEXT:    rorl %edi # sched: [2:1.00]
+; HASWELL-NEXT:    roll (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rorl (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    roll $7, %edi # sched: [2:1.00]
+; HASWELL-NEXT:    rorl $7, %edi # sched: [2:1.00]
+; HASWELL-NEXT:    roll $7, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rorl $7, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    roll %cl, %edi # sched: [3:1.00]
+; HASWELL-NEXT:    rorl %cl, %edi # sched: [3:1.00]
+; HASWELL-NEXT:    roll %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rorl %cl, (%rdx) # sched: [9:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sar_shl_shr_32:
+; BROADWELL-LABEL: test_rol_ror_32:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    sarl %edi # sched: [1:0.50]
-; BROADWELL-NEXT:    shll %edi # sched: [1:0.50]
-; BROADWELL-NEXT:    shrl %edi # sched: [1:0.50]
-; BROADWELL-NEXT:    sarl (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shll (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shrl (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    sarl $7, %edi # sched: [1:0.50]
-; BROADWELL-NEXT:    shll $7, %edi # sched: [1:0.50]
-; BROADWELL-NEXT:    shrl $7, %edi # sched: [1:0.50]
-; BROADWELL-NEXT:    sarl $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shll $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shrl $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    sarl %cl, %edi # sched: [3:1.00]
-; BROADWELL-NEXT:    shll %cl, %edi # sched: [3:1.00]
-; BROADWELL-NEXT:    shrl %cl, %edi # sched: [3:1.00]
-; BROADWELL-NEXT:    sarl %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    shll %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    shrl %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    roll %edi # sched: [2:1.00]
+; BROADWELL-NEXT:    rorl %edi # sched: [2:1.00]
+; BROADWELL-NEXT:    roll (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rorl (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    roll $7, %edi # sched: [2:1.00]
+; BROADWELL-NEXT:    rorl $7, %edi # sched: [2:1.00]
+; BROADWELL-NEXT:    roll $7, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rorl $7, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    roll %cl, %edi # sched: [3:1.00]
+; BROADWELL-NEXT:    rorl %cl, %edi # sched: [3:1.00]
+; BROADWELL-NEXT:    roll %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rorl %cl, (%rdx) # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sar_shl_shr_32:
+; SKYLAKE-LABEL: test_rol_ror_32:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    sarl %edi # sched: [1:0.50]
-; SKYLAKE-NEXT:    shll %edi # sched: [1:0.50]
-; SKYLAKE-NEXT:    shrl %edi # sched: [1:0.50]
-; SKYLAKE-NEXT:    sarl (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shll (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrl (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    sarl $7, %edi # sched: [1:0.50]
-; SKYLAKE-NEXT:    shll $7, %edi # sched: [1:0.50]
-; SKYLAKE-NEXT:    shrl $7, %edi # sched: [1:0.50]
-; SKYLAKE-NEXT:    sarl $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shll $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrl $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    sarl %cl, %edi # sched: [3:1.50]
-; SKYLAKE-NEXT:    shll %cl, %edi # sched: [3:1.50]
-; SKYLAKE-NEXT:    shrl %cl, %edi # sched: [3:1.50]
-; SKYLAKE-NEXT:    sarl %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    shll %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    shrl %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    roll %edi # sched: [2:1.00]
+; SKYLAKE-NEXT:    rorl %edi # sched: [2:1.00]
+; SKYLAKE-NEXT:    roll (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rorl (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    roll $7, %edi # sched: [2:1.00]
+; SKYLAKE-NEXT:    rorl $7, %edi # sched: [2:1.00]
+; SKYLAKE-NEXT:    roll $7, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rorl $7, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    roll %cl, %edi # sched: [3:1.50]
+; SKYLAKE-NEXT:    rorl %cl, %edi # sched: [3:1.50]
+; SKYLAKE-NEXT:    roll %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rorl %cl, (%rdx) # sched: [8:1.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sar_shl_shr_32:
+; SKX-LABEL: test_rol_ror_32:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    sarl %edi # sched: [1:0.50]
-; SKX-NEXT:    shll %edi # sched: [1:0.50]
-; SKX-NEXT:    shrl %edi # sched: [1:0.50]
-; SKX-NEXT:    sarl (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shll (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shrl (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    sarl $7, %edi # sched: [1:0.50]
-; SKX-NEXT:    shll $7, %edi # sched: [1:0.50]
-; SKX-NEXT:    shrl $7, %edi # sched: [1:0.50]
-; SKX-NEXT:    sarl $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shll $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shrl $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    sarl %cl, %edi # sched: [3:1.50]
-; SKX-NEXT:    shll %cl, %edi # sched: [3:1.50]
-; SKX-NEXT:    shrl %cl, %edi # sched: [3:1.50]
-; SKX-NEXT:    sarl %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    shll %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    shrl %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    roll %edi # sched: [2:1.00]
+; SKX-NEXT:    rorl %edi # sched: [2:1.00]
+; SKX-NEXT:    roll (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rorl (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    roll $7, %edi # sched: [2:1.00]
+; SKX-NEXT:    rorl $7, %edi # sched: [2:1.00]
+; SKX-NEXT:    roll $7, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rorl $7, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    roll %cl, %edi # sched: [3:1.50]
+; SKX-NEXT:    rorl %cl, %edi # sched: [3:1.50]
+; SKX-NEXT:    roll %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rorl %cl, (%rdx) # sched: [8:1.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sar_shl_shr_32:
+; BTVER2-LABEL: test_rol_ror_32:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    sarl %edi # sched: [1:0.50]
-; BTVER2-NEXT:    shll %edi # sched: [1:0.50]
-; BTVER2-NEXT:    shrl %edi # sched: [1:0.50]
-; BTVER2-NEXT:    sarl (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shll (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrl (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    sarl $7, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    shll $7, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    shrl $7, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    sarl $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shll $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrl $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    sarl %cl, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    shll %cl, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    shrl %cl, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    sarl %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shll %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrl %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    roll %edi # sched: [1:0.50]
+; BTVER2-NEXT:    rorl %edi # sched: [1:0.50]
+; BTVER2-NEXT:    roll (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorl (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    roll $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    rorl $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    roll $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorl $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    roll %cl, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    rorl %cl, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    roll %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorl %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sar_shl_shr_32:
+; ZNVER1-LABEL: test_rol_ror_32:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    sarl %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    shll %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    shrl %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    sarl (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shll (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrl (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    sarl $7, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    shll $7, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    shrl $7, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    sarl $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shll $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrl $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    sarl %cl, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    shll %cl, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    shrl %cl, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    sarl %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    shll %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    shrl %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    roll %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    rorl %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    roll (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorl (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    roll $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    rorl $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    roll $7, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorl $7, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    roll %cl, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    rorl %cl, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    roll %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorl %cl, (%rdx) # sched: [5:1.00]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "sarl $0 \0A\09 shll $0 \0A\09 shrl $0 \0A\09 sarl $2 \0A\09 shll $2 \0A\09 shrl $2 \0A\09 sarl $3, $0 \0A\09 shll $3, $0 \0A\09 shrl $3, $0 \0A\09 sarl $3, $2 \0A\09 shll $3, $2 \0A\09 shrl $3, $2 \0A\09 sarl %CL, $0 \0A\09 shll %CL, $0 \0A\09 shrl %CL, $0 \0A\09 sarl %CL, $2  \0A\09 shll %CL, $2 \0A\09 shrl %CL, $2", "r,r,*m,i"(i32 %a0, i32 %a1, i32 *%a2, i8 7)
+  call void asm sideeffect "roll $0 \0A\09 rorl $0 \0A\09 roll $2 \0A\09 rorl $2 \0A\09 roll $3, $0 \0A\09 rorl $3, $0 \0A\09 roll $3, $2 \0A\09 rorl $3, $2 \0A\09 roll %CL, $0 \0A\09 rorl %CL, $0 \0A\09 roll %CL, $2 \0A\09 rorl %CL, $2", "r,r,*m,i"(i32 %a0, i32 %a1, i32 *%a2, i8 7)
   ret void
 }
-define void @test_sar_shl_shr_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
-; GENERIC-LABEL: test_sar_shl_shr_64:
+define void @test_rol_ror_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
+; GENERIC-LABEL: test_rol_ror_64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    sarq %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    shlq %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    shrq %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    sarq (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    shlq (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shrq (%rdx) # sched: [5:1.00]
-; GENERIC-NEXT:    sarq $7, %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    shlq $7, %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    shrq $7, %rdi # sched: [1:0.50]
-; GENERIC-NEXT:    sarq $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shlq $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    shrq $7, (%rdx) # sched: [7:1.00]
-; GENERIC-NEXT:    sarq %cl, %rdi # sched: [3:1.50]
-; GENERIC-NEXT:    shlq %cl, %rdi # sched: [3:1.50]
-; GENERIC-NEXT:    shrq %cl, %rdi # sched: [3:1.50]
-; GENERIC-NEXT:    sarq %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    shlq %cl, (%rdx) # sched: [9:1.50]
-; GENERIC-NEXT:    shrq %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rolq %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    rorq %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    rolq (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rorq (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    rolq $7, %rdi # sched: [2:1.00]
+; GENERIC-NEXT:    rorq $7, %rdi # sched: [2:1.00]
+; GENERIC-NEXT:    rolq $7, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    rorq $7, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    rolq %cl, %rdi # sched: [3:1.50]
+; GENERIC-NEXT:    rorq %cl, %rdi # sched: [3:1.50]
+; GENERIC-NEXT:    rolq %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    rorq %cl, (%rdx) # sched: [9:1.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sar_shl_shr_64:
+; ATOM-LABEL: test_rol_ror_64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    sarq %rdi # sched: [1:1.00]
-; ATOM-NEXT:    shlq %rdi # sched: [1:1.00]
-; ATOM-NEXT:    shrq %rdi # sched: [1:1.00]
-; ATOM-NEXT:    sarq (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shlq (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrq (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    sarq $7, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    shlq $7, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    shrq $7, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    sarq $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shlq $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrq $7, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    sarq %cl, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    shlq %cl, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    shrq %cl, %rdi # sched: [1:1.00]
-; ATOM-NEXT:    sarq %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shlq %cl, (%rdx) # sched: [1:1.00]
-; ATOM-NEXT:    shrq %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rolq %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rorq %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rolq (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorq (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rolq $7, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rorq $7, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rolq $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorq $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rolq %cl, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rorq %cl, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    rolq %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    rorq %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sar_shl_shr_64:
+; SLM-LABEL: test_rol_ror_64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    sarq %rdi # sched: [1:1.00]
-; SLM-NEXT:    shlq %rdi # sched: [1:1.00]
-; SLM-NEXT:    shrq %rdi # sched: [1:1.00]
-; SLM-NEXT:    sarq (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shlq (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrq (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    sarq $7, %rdi # sched: [1:1.00]
-; SLM-NEXT:    shlq $7, %rdi # sched: [1:1.00]
-; SLM-NEXT:    shrq $7, %rdi # sched: [1:1.00]
-; SLM-NEXT:    sarq $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shlq $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrq $7, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    sarq %cl, %rdi # sched: [1:1.00]
-; SLM-NEXT:    shlq %cl, %rdi # sched: [1:1.00]
-; SLM-NEXT:    shrq %cl, %rdi # sched: [1:1.00]
-; SLM-NEXT:    sarq %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shlq %cl, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrq %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rolq %rdi # sched: [1:1.00]
+; SLM-NEXT:    rorq %rdi # sched: [1:1.00]
+; SLM-NEXT:    rolq (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorq (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rolq $7, %rdi # sched: [1:1.00]
+; SLM-NEXT:    rorq $7, %rdi # sched: [1:1.00]
+; SLM-NEXT:    rolq $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorq $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rolq %cl, %rdi # sched: [1:1.00]
+; SLM-NEXT:    rorq %cl, %rdi # sched: [1:1.00]
+; SLM-NEXT:    rolq %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    rorq %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sar_shl_shr_64:
+; SANDY-LABEL: test_rol_ror_64:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    sarq %rdi # sched: [1:0.50]
-; SANDY-NEXT:    shlq %rdi # sched: [1:0.50]
-; SANDY-NEXT:    shrq %rdi # sched: [1:0.50]
-; SANDY-NEXT:    sarq (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    shlq (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shrq (%rdx) # sched: [5:1.00]
-; SANDY-NEXT:    sarq $7, %rdi # sched: [1:0.50]
-; SANDY-NEXT:    shlq $7, %rdi # sched: [1:0.50]
-; SANDY-NEXT:    shrq $7, %rdi # sched: [1:0.50]
-; SANDY-NEXT:    sarq $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shlq $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    shrq $7, (%rdx) # sched: [7:1.00]
-; SANDY-NEXT:    sarq %cl, %rdi # sched: [3:1.50]
-; SANDY-NEXT:    shlq %cl, %rdi # sched: [3:1.50]
-; SANDY-NEXT:    shrq %cl, %rdi # sched: [3:1.50]
-; SANDY-NEXT:    sarq %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    shlq %cl, (%rdx) # sched: [9:1.50]
-; SANDY-NEXT:    shrq %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rolq %rdi # sched: [1:0.50]
+; SANDY-NEXT:    rorq %rdi # sched: [1:0.50]
+; SANDY-NEXT:    rolq (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rorq (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    rolq $7, %rdi # sched: [2:1.00]
+; SANDY-NEXT:    rorq $7, %rdi # sched: [2:1.00]
+; SANDY-NEXT:    rolq $7, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    rorq $7, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    rolq %cl, %rdi # sched: [3:1.50]
+; SANDY-NEXT:    rorq %cl, %rdi # sched: [3:1.50]
+; SANDY-NEXT:    rolq %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    rorq %cl, (%rdx) # sched: [9:1.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sar_shl_shr_64:
+; HASWELL-LABEL: test_rol_ror_64:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    sarq %rdi # sched: [1:0.50]
-; HASWELL-NEXT:    shlq %rdi # sched: [1:0.50]
-; HASWELL-NEXT:    shrq %rdi # sched: [1:0.50]
-; HASWELL-NEXT:    sarq (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shlq (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shrq (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    sarq $7, %rdi # sched: [1:0.50]
-; HASWELL-NEXT:    shlq $7, %rdi # sched: [1:0.50]
-; HASWELL-NEXT:    shrq $7, %rdi # sched: [1:0.50]
-; HASWELL-NEXT:    sarq $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shlq $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    shrq $7, (%rdx) # sched: [7:1.00]
-; HASWELL-NEXT:    sarq %cl, %rdi # sched: [3:1.00]
-; HASWELL-NEXT:    shlq %cl, %rdi # sched: [3:1.00]
-; HASWELL-NEXT:    shrq %cl, %rdi # sched: [3:1.00]
-; HASWELL-NEXT:    sarq %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    shlq %cl, (%rdx) # sched: [9:1.00]
-; HASWELL-NEXT:    shrq %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rolq %rdi # sched: [2:1.00]
+; HASWELL-NEXT:    rorq %rdi # sched: [2:1.00]
+; HASWELL-NEXT:    rolq (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rorq (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rolq $7, %rdi # sched: [2:1.00]
+; HASWELL-NEXT:    rorq $7, %rdi # sched: [2:1.00]
+; HASWELL-NEXT:    rolq $7, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rorq $7, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    rolq %cl, %rdi # sched: [3:1.00]
+; HASWELL-NEXT:    rorq %cl, %rdi # sched: [3:1.00]
+; HASWELL-NEXT:    rolq %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    rorq %cl, (%rdx) # sched: [9:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sar_shl_shr_64:
+; BROADWELL-LABEL: test_rol_ror_64:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    sarq %rdi # sched: [1:0.50]
-; BROADWELL-NEXT:    shlq %rdi # sched: [1:0.50]
-; BROADWELL-NEXT:    shrq %rdi # sched: [1:0.50]
-; BROADWELL-NEXT:    sarq (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shlq (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shrq (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    sarq $7, %rdi # sched: [1:0.50]
-; BROADWELL-NEXT:    shlq $7, %rdi # sched: [1:0.50]
-; BROADWELL-NEXT:    shrq $7, %rdi # sched: [1:0.50]
-; BROADWELL-NEXT:    sarq $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shlq $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    shrq $7, (%rdx) # sched: [6:1.00]
-; BROADWELL-NEXT:    sarq %cl, %rdi # sched: [3:1.00]
-; BROADWELL-NEXT:    shlq %cl, %rdi # sched: [3:1.00]
-; BROADWELL-NEXT:    shrq %cl, %rdi # sched: [3:1.00]
-; BROADWELL-NEXT:    sarq %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    shlq %cl, (%rdx) # sched: [8:1.00]
-; BROADWELL-NEXT:    shrq %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rolq %rdi # sched: [2:1.00]
+; BROADWELL-NEXT:    rorq %rdi # sched: [2:1.00]
+; BROADWELL-NEXT:    rolq (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rorq (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rolq $7, %rdi # sched: [2:1.00]
+; BROADWELL-NEXT:    rorq $7, %rdi # sched: [2:1.00]
+; BROADWELL-NEXT:    rolq $7, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rorq $7, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    rolq %cl, %rdi # sched: [3:1.00]
+; BROADWELL-NEXT:    rorq %cl, %rdi # sched: [3:1.00]
+; BROADWELL-NEXT:    rolq %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    rorq %cl, (%rdx) # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sar_shl_shr_64:
+; SKYLAKE-LABEL: test_rol_ror_64:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    sarq %rdi # sched: [1:0.50]
-; SKYLAKE-NEXT:    shlq %rdi # sched: [1:0.50]
-; SKYLAKE-NEXT:    shrq %rdi # sched: [1:0.50]
-; SKYLAKE-NEXT:    sarq (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shlq (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrq (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    sarq $7, %rdi # sched: [1:0.50]
-; SKYLAKE-NEXT:    shlq $7, %rdi # sched: [1:0.50]
-; SKYLAKE-NEXT:    shrq $7, %rdi # sched: [1:0.50]
-; SKYLAKE-NEXT:    sarq $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shlq $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrq $7, (%rdx) # sched: [6:1.00]
-; SKYLAKE-NEXT:    sarq %cl, %rdi # sched: [3:1.50]
-; SKYLAKE-NEXT:    shlq %cl, %rdi # sched: [3:1.50]
-; SKYLAKE-NEXT:    shrq %cl, %rdi # sched: [3:1.50]
-; SKYLAKE-NEXT:    sarq %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    shlq %cl, (%rdx) # sched: [8:1.50]
-; SKYLAKE-NEXT:    shrq %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rolq %rdi # sched: [2:1.00]
+; SKYLAKE-NEXT:    rorq %rdi # sched: [2:1.00]
+; SKYLAKE-NEXT:    rolq (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rorq (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rolq $7, %rdi # sched: [2:1.00]
+; SKYLAKE-NEXT:    rorq $7, %rdi # sched: [2:1.00]
+; SKYLAKE-NEXT:    rolq $7, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rorq $7, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    rolq %cl, %rdi # sched: [3:1.50]
+; SKYLAKE-NEXT:    rorq %cl, %rdi # sched: [3:1.50]
+; SKYLAKE-NEXT:    rolq %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    rorq %cl, (%rdx) # sched: [8:1.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sar_shl_shr_64:
+; SKX-LABEL: test_rol_ror_64:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    sarq %rdi # sched: [1:0.50]
-; SKX-NEXT:    shlq %rdi # sched: [1:0.50]
-; SKX-NEXT:    shrq %rdi # sched: [1:0.50]
-; SKX-NEXT:    sarq (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shlq (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shrq (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    sarq $7, %rdi # sched: [1:0.50]
-; SKX-NEXT:    shlq $7, %rdi # sched: [1:0.50]
-; SKX-NEXT:    shrq $7, %rdi # sched: [1:0.50]
-; SKX-NEXT:    sarq $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shlq $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    shrq $7, (%rdx) # sched: [6:1.00]
-; SKX-NEXT:    sarq %cl, %rdi # sched: [3:1.50]
-; SKX-NEXT:    shlq %cl, %rdi # sched: [3:1.50]
-; SKX-NEXT:    shrq %cl, %rdi # sched: [3:1.50]
-; SKX-NEXT:    sarq %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    shlq %cl, (%rdx) # sched: [8:1.50]
-; SKX-NEXT:    shrq %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rolq %rdi # sched: [2:1.00]
+; SKX-NEXT:    rorq %rdi # sched: [2:1.00]
+; SKX-NEXT:    rolq (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rorq (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rolq $7, %rdi # sched: [2:1.00]
+; SKX-NEXT:    rorq $7, %rdi # sched: [2:1.00]
+; SKX-NEXT:    rolq $7, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rorq $7, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    rolq %cl, %rdi # sched: [3:1.50]
+; SKX-NEXT:    rorq %cl, %rdi # sched: [3:1.50]
+; SKX-NEXT:    rolq %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    rorq %cl, (%rdx) # sched: [8:1.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sar_shl_shr_64:
+; BTVER2-LABEL: test_rol_ror_64:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    sarq %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    shlq %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    shrq %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    sarq (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shlq (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrq (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    sarq $7, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    shlq $7, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    shrq $7, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    sarq $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shlq $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrq $7, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    sarq %cl, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    shlq %cl, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    shrq %cl, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    sarq %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shlq %cl, (%rdx) # sched: [4:1.00]
-; BTVER2-NEXT:    shrq %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rolq %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rorq %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rolq (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorq (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rolq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rorq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rolq $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorq $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rolq %cl, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rorq %cl, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    rolq %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    rorq %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sar_shl_shr_64:
+; ZNVER1-LABEL: test_rol_ror_64:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    sarq %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    shlq %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    shrq %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    sarq (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shlq (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrq (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    sarq $7, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    shlq $7, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    shrq $7, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    sarq $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shlq $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrq $7, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    sarq %cl, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    shlq %cl, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    shrq %cl, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    sarq %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    shlq %cl, (%rdx) # sched: [5:1.00]
-; ZNVER1-NEXT:    shrq %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rolq %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rorq %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rolq (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorq (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rolq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rorq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rolq $7, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorq $7, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rolq %cl, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rorq %cl, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    rolq %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    rorq %cl, (%rdx) # sched: [5:1.00]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "sarq $0 \0A\09 shlq $0 \0A\09 shrq $0 \0A\09 sarq $2 \0A\09 shlq $2 \0A\09 shrq $2 \0A\09 sarq $3, $0 \0A\09 shlq $3, $0 \0A\09 shrq $3, $0 \0A\09 sarq $3, $2 \0A\09 shlq $3, $2 \0A\09 shrq $3, $2 \0A\09 sarq %CL, $0 \0A\09 shlq %CL, $0 \0A\09 shrq %CL, $0 \0A\09 sarq %CL, $2  \0A\09 shlq %CL, $2 \0A\09 shrq %CL, $2", "r,r,*m,i"(i64 %a0, i64 %a1, i64 *%a2, i8 7)
+  call void asm sideeffect "rolq $0 \0A\09 rorq $0 \0A\09 rolq $2 \0A\09 rorq $2 \0A\09 rolq $3, $0 \0A\09 rorq $3, $0 \0A\09 rolq $3, $2 \0A\09 rorq $3, $2 \0A\09 rolq %CL, $0 \0A\09 rorq %CL, $0 \0A\09 rolq %CL, $2 \0A\09 rorq %CL, $2", "r,r,*m,i"(i64 %a0, i64 %a1, i64 *%a2, i8 7)
   ret void
 }
 
-define void @test_sbb_8(i8 %a0, i8* %a1) optsize {
-; GENERIC-LABEL: test_sbb_8:
+define void @test_sar_shl_shr_8(i8 %a0, i8 %a1, i8 *%a2) optsize {
+; GENERIC-LABEL: test_sar_shl_shr_8:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    sbbb $7, %al # sched: [3:1.00]
-; GENERIC-NEXT:    sbbb $7, %dil # sched: [2:0.67]
-; GENERIC-NEXT:    sbbb $7, (%rsi) # sched: [9:1.00]
-; GENERIC-NEXT:    sbbb %dil, %dil # sched: [2:0.67]
-; GENERIC-NEXT:    sbbb %dil, (%rsi) # sched: [9:1.00]
-; GENERIC-NEXT:    sbbb (%rsi), %dil # sched: [7:0.67]
+; GENERIC-NEXT:    sarb %dil # sched: [1:0.50]
+; GENERIC-NEXT:    shlb %dil # sched: [1:0.50]
+; GENERIC-NEXT:    shrb %dil # sched: [1:0.50]
+; GENERIC-NEXT:    sarb (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    shlb (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shrb (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    sarb $7, %dil # sched: [1:0.50]
+; GENERIC-NEXT:    shlb $7, %dil # sched: [1:0.50]
+; GENERIC-NEXT:    shrb $7, %dil # sched: [1:0.50]
+; GENERIC-NEXT:    sarb $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shlb $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shrb $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    sarb %cl, %dil # sched: [3:1.50]
+; GENERIC-NEXT:    shlb %cl, %dil # sched: [3:1.50]
+; GENERIC-NEXT:    shrb %cl, %dil # sched: [3:1.50]
+; GENERIC-NEXT:    sarb %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    shlb %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    shrb %cl, (%rdx) # sched: [9:1.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sbb_8:
+; ATOM-LABEL: test_sar_shl_shr_8:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    sbbb $7, %al # sched: [1:0.50]
-; ATOM-NEXT:    sbbb $7, %dil # sched: [1:0.50]
-; ATOM-NEXT:    sbbb $7, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
-; ATOM-NEXT:    sbbb %dil, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    sbbb (%rsi), %dil # sched: [1:1.00]
+; ATOM-NEXT:    sarb %dil # sched: [1:1.00]
+; ATOM-NEXT:    shlb %dil # sched: [1:1.00]
+; ATOM-NEXT:    shrb %dil # sched: [1:1.00]
+; ATOM-NEXT:    sarb (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shlb (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrb (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    sarb $7, %dil # sched: [1:1.00]
+; ATOM-NEXT:    shlb $7, %dil # sched: [1:1.00]
+; ATOM-NEXT:    shrb $7, %dil # sched: [1:1.00]
+; ATOM-NEXT:    sarb $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shlb $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrb $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    sarb %cl, %dil # sched: [1:1.00]
+; ATOM-NEXT:    shlb %cl, %dil # sched: [1:1.00]
+; ATOM-NEXT:    shrb %cl, %dil # sched: [1:1.00]
+; ATOM-NEXT:    sarb %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shlb %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrb %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sbb_8:
+; SLM-LABEL: test_sar_shl_shr_8:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    sbbb $7, %al # sched: [1:0.50]
-; SLM-NEXT:    sbbb $7, %dil # sched: [1:0.50]
-; SLM-NEXT:    sbbb $7, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
-; SLM-NEXT:    sbbb %dil, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    sbbb (%rsi), %dil # sched: [4:1.00]
+; SLM-NEXT:    sarb %dil # sched: [1:1.00]
+; SLM-NEXT:    shlb %dil # sched: [1:1.00]
+; SLM-NEXT:    shrb %dil # sched: [1:1.00]
+; SLM-NEXT:    sarb (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shlb (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrb (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    sarb $7, %dil # sched: [1:1.00]
+; SLM-NEXT:    shlb $7, %dil # sched: [1:1.00]
+; SLM-NEXT:    shrb $7, %dil # sched: [1:1.00]
+; SLM-NEXT:    sarb $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shlb $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrb $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    sarb %cl, %dil # sched: [1:1.00]
+; SLM-NEXT:    shlb %cl, %dil # sched: [1:1.00]
+; SLM-NEXT:    shrb %cl, %dil # sched: [1:1.00]
+; SLM-NEXT:    sarb %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shlb %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrb %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sbb_8:
+; SANDY-LABEL: test_sar_shl_shr_8:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    sbbb $7, %al # sched: [3:1.00]
-; SANDY-NEXT:    sbbb $7, %dil # sched: [2:0.67]
-; SANDY-NEXT:    sbbb $7, (%rsi) # sched: [9:1.00]
-; SANDY-NEXT:    sbbb %dil, %dil # sched: [2:0.67]
-; SANDY-NEXT:    sbbb %dil, (%rsi) # sched: [9:1.00]
-; SANDY-NEXT:    sbbb (%rsi), %dil # sched: [7:0.67]
+; SANDY-NEXT:    sarb %dil # sched: [1:0.50]
+; SANDY-NEXT:    shlb %dil # sched: [1:0.50]
+; SANDY-NEXT:    shrb %dil # sched: [1:0.50]
+; SANDY-NEXT:    sarb (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    shlb (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shrb (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    sarb $7, %dil # sched: [1:0.50]
+; SANDY-NEXT:    shlb $7, %dil # sched: [1:0.50]
+; SANDY-NEXT:    shrb $7, %dil # sched: [1:0.50]
+; SANDY-NEXT:    sarb $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shlb $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shrb $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    sarb %cl, %dil # sched: [3:1.50]
+; SANDY-NEXT:    shlb %cl, %dil # sched: [3:1.50]
+; SANDY-NEXT:    shrb %cl, %dil # sched: [3:1.50]
+; SANDY-NEXT:    sarb %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    shlb %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    shrb %cl, (%rdx) # sched: [9:1.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sbb_8:
+; HASWELL-LABEL: test_sar_shl_shr_8:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    sbbb $7, %al # sched: [2:0.50]
-; HASWELL-NEXT:    sbbb $7, %dil # sched: [2:0.50]
-; HASWELL-NEXT:    sbbb $7, (%rsi) # sched: [9:1.00]
-; HASWELL-NEXT:    sbbb %dil, %dil # sched: [2:0.50]
-; HASWELL-NEXT:    sbbb %dil, (%rsi) # sched: [9:1.00]
-; HASWELL-NEXT:    sbbb (%rsi), %dil # sched: [7:0.50]
+; HASWELL-NEXT:    sarb %dil # sched: [1:0.50]
+; HASWELL-NEXT:    shlb %dil # sched: [1:0.50]
+; HASWELL-NEXT:    shrb %dil # sched: [1:0.50]
+; HASWELL-NEXT:    sarb (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shlb (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shrb (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    sarb $7, %dil # sched: [1:0.50]
+; HASWELL-NEXT:    shlb $7, %dil # sched: [1:0.50]
+; HASWELL-NEXT:    shrb $7, %dil # sched: [1:0.50]
+; HASWELL-NEXT:    sarb $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shlb $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shrb $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    sarb %cl, %dil # sched: [3:1.00]
+; HASWELL-NEXT:    shlb %cl, %dil # sched: [3:1.00]
+; HASWELL-NEXT:    shrb %cl, %dil # sched: [3:1.00]
+; HASWELL-NEXT:    sarb %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    shlb %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    shrb %cl, (%rdx) # sched: [9:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sbb_8:
+; BROADWELL-LABEL: test_sar_shl_shr_8:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    sbbb $7, %al # sched: [2:0.50]
-; BROADWELL-NEXT:    sbbb $7, %dil # sched: [2:0.50]
-; BROADWELL-NEXT:    sbbb $7, (%rsi) # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbb %dil, (%rsi) # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbb (%rsi), %dil # sched: [6:0.50]
+; BROADWELL-NEXT:    sarb %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    shlb %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    shrb %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    sarb (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shlb (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shrb (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    sarb $7, %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    shlb $7, %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    shrb $7, %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    sarb $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shlb $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shrb $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    sarb %cl, %dil # sched: [3:1.00]
+; BROADWELL-NEXT:    shlb %cl, %dil # sched: [3:1.00]
+; BROADWELL-NEXT:    shrb %cl, %dil # sched: [3:1.00]
+; BROADWELL-NEXT:    sarb %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    shlb %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    shrb %cl, (%rdx) # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sbb_8:
+; SKYLAKE-LABEL: test_sar_shl_shr_8:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    sbbb $7, %al # sched: [2:0.50]
-; SKYLAKE-NEXT:    sbbb $7, %dil # sched: [2:0.50]
-; SKYLAKE-NEXT:    sbbb $7, (%rsi) # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbb %dil, (%rsi) # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbb (%rsi), %dil # sched: [6:0.50]
+; SKYLAKE-NEXT:    sarb %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    shlb %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    shrb %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    sarb (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shlb (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrb (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    sarb $7, %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    shlb $7, %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    shrb $7, %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    sarb $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shlb $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrb $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    sarb %cl, %dil # sched: [3:1.50]
+; SKYLAKE-NEXT:    shlb %cl, %dil # sched: [3:1.50]
+; SKYLAKE-NEXT:    shrb %cl, %dil # sched: [3:1.50]
+; SKYLAKE-NEXT:    sarb %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    shlb %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    shrb %cl, (%rdx) # sched: [8:1.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sbb_8:
+; SKX-LABEL: test_sar_shl_shr_8:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    sbbb $7, %al # sched: [2:0.50]
-; SKX-NEXT:    sbbb $7, %dil # sched: [2:0.50]
-; SKX-NEXT:    sbbb $7, (%rsi) # sched: [8:1.00]
-; SKX-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
-; SKX-NEXT:    sbbb %dil, (%rsi) # sched: [8:1.00]
-; SKX-NEXT:    sbbb (%rsi), %dil # sched: [6:0.50]
+; SKX-NEXT:    sarb %dil # sched: [1:0.50]
+; SKX-NEXT:    shlb %dil # sched: [1:0.50]
+; SKX-NEXT:    shrb %dil # sched: [1:0.50]
+; SKX-NEXT:    sarb (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shlb (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shrb (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    sarb $7, %dil # sched: [1:0.50]
+; SKX-NEXT:    shlb $7, %dil # sched: [1:0.50]
+; SKX-NEXT:    shrb $7, %dil # sched: [1:0.50]
+; SKX-NEXT:    sarb $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shlb $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shrb $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    sarb %cl, %dil # sched: [3:1.50]
+; SKX-NEXT:    shlb %cl, %dil # sched: [3:1.50]
+; SKX-NEXT:    shrb %cl, %dil # sched: [3:1.50]
+; SKX-NEXT:    sarb %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    shlb %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    shrb %cl, (%rdx) # sched: [8:1.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sbb_8:
+; BTVER2-LABEL: test_sar_shl_shr_8:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    sbbb $7, %al # sched: [1:0.50]
-; BTVER2-NEXT:    sbbb $7, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    sbbb $7, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    sbbb %dil, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    sbbb (%rsi), %dil # sched: [4:1.00]
+; BTVER2-NEXT:    sarb %dil # sched: [1:0.50]
+; BTVER2-NEXT:    shlb %dil # sched: [1:0.50]
+; BTVER2-NEXT:    shrb %dil # sched: [1:0.50]
+; BTVER2-NEXT:    sarb (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shlb (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrb (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    sarb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    shlb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    shrb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    sarb $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shlb $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrb $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    sarb %cl, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    shlb %cl, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    shrb %cl, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    sarb %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shlb %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrb %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sbb_8:
+; ZNVER1-LABEL: test_sar_shl_shr_8:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    sbbb $7, %al # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbb $7, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbb $7, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbb %dil, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbb %dil, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbb (%rsi), %dil # sched: [5:0.50]
+; ZNVER1-NEXT:    sarb %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    shlb %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    shrb %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    sarb (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shlb (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrb (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    sarb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    shlb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    shrb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    sarb $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shlb $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrb $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    sarb %cl, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    shlb %cl, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    shrb %cl, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    sarb %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    shlb %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    shrb %cl, (%rdx) # sched: [5:1.00]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "sbbb $2, %AL \0A\09 sbbb $2, $0 \0A\09 sbbb $2, $1 \0A\09 sbbb $0, $0 \0A\09 sbbb $0, $1 \0A\09 sbbb $1, $0", "r,*m,i"(i8 %a0, i8* %a1, i8 7) nounwind
+  call void asm sideeffect "sarb $0 \0A\09 shlb $0 \0A\09 shrb $0 \0A\09 sarb $2 \0A\09 shlb $2 \0A\09 shrb $2 \0A\09 sarb $3, $0 \0A\09 shlb $3, $0 \0A\09 shrb $3, $0 \0A\09 sarb $3, $2 \0A\09 shlb $3, $2 \0A\09 shrb $3, $2 \0A\09 sarb %CL, $0 \0A\09 shlb %CL, $0 \0A\09 shrb %CL, $0 \0A\09 sarb %CL, $2  \0A\09 shlb %CL, $2 \0A\09 shrb %CL, $2", "r,r,*m,i"(i8 %a0, i8 %a1, i8 *%a2, i8 7)
   ret void
 }
-define void @test_sbb_16(i16 %a0, i16* %a1) optsize {
-; GENERIC-LABEL: test_sbb_16:
+define void @test_sar_shl_shr_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
+; GENERIC-LABEL: test_sar_shl_shr_16:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; GENERIC-NEXT:    # sched: [1:0.33]
-; GENERIC-NEXT:    sbbw $511, %di # imm = 0x1FF
-; GENERIC-NEXT:    # sched: [2:0.67]
-; GENERIC-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; GENERIC-NEXT:    # sched: [9:1.00]
-; GENERIC-NEXT:    sbbw $7, %di # sched: [2:0.67]
-; GENERIC-NEXT:    sbbw $7, (%rsi) # sched: [9:1.00]
-; GENERIC-NEXT:    sbbw %di, %di # sched: [2:0.67]
-; GENERIC-NEXT:    sbbw %di, (%rsi) # sched: [9:1.00]
-; GENERIC-NEXT:    sbbw (%rsi), %di # sched: [7:0.67]
-; GENERIC-NEXT:    #NO_APP
-; GENERIC-NEXT:    retq # sched: [1:1.00]
-;
-; ATOM-LABEL: test_sbb_16:
-; ATOM:       # %bb.0:
-; ATOM-NEXT:    #APP
-; ATOM-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    sbbw $511, %di # imm = 0x1FF
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; ATOM-NEXT:    # sched: [1:1.00]
-; ATOM-NEXT:    sbbw $7, %di # sched: [1:0.50]
-; ATOM-NEXT:    sbbw $7, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    sbbw %di, %di # sched: [1:0.50]
-; ATOM-NEXT:    sbbw %di, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    sbbw (%rsi), %di # sched: [1:1.00]
+; GENERIC-NEXT:    sarw %di # sched: [1:0.50]
+; GENERIC-NEXT:    shlw %di # sched: [1:0.50]
+; GENERIC-NEXT:    shrw %di # sched: [1:0.50]
+; GENERIC-NEXT:    sarw (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    shlw (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shrw (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    sarw $7, %di # sched: [1:0.50]
+; GENERIC-NEXT:    shlw $7, %di # sched: [1:0.50]
+; GENERIC-NEXT:    shrw $7, %di # sched: [1:0.50]
+; GENERIC-NEXT:    sarw $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shlw $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shrw $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    sarw %cl, %di # sched: [3:1.50]
+; GENERIC-NEXT:    shlw %cl, %di # sched: [3:1.50]
+; GENERIC-NEXT:    shrw %cl, %di # sched: [3:1.50]
+; GENERIC-NEXT:    sarw %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    shlw %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    shrw %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_sar_shl_shr_16:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    sarw %di # sched: [1:1.00]
+; ATOM-NEXT:    shlw %di # sched: [1:1.00]
+; ATOM-NEXT:    shrw %di # sched: [1:1.00]
+; ATOM-NEXT:    sarw (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shlw (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrw (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    sarw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    shlw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    shrw $7, %di # sched: [1:1.00]
+; ATOM-NEXT:    sarw $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shlw $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrw $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    sarw %cl, %di # sched: [1:1.00]
+; ATOM-NEXT:    shlw %cl, %di # sched: [1:1.00]
+; ATOM-NEXT:    shrw %cl, %di # sched: [1:1.00]
+; ATOM-NEXT:    sarw %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shlw %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrw %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sbb_16:
+; SLM-LABEL: test_sar_shl_shr_16:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    sbbw $511, %di # imm = 0x1FF
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; SLM-NEXT:    # sched: [4:2.00]
-; SLM-NEXT:    sbbw $7, %di # sched: [1:0.50]
-; SLM-NEXT:    sbbw $7, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    sbbw %di, %di # sched: [1:0.50]
-; SLM-NEXT:    sbbw %di, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    sbbw (%rsi), %di # sched: [4:1.00]
+; SLM-NEXT:    sarw %di # sched: [1:1.00]
+; SLM-NEXT:    shlw %di # sched: [1:1.00]
+; SLM-NEXT:    shrw %di # sched: [1:1.00]
+; SLM-NEXT:    sarw (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shlw (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrw (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    sarw $7, %di # sched: [1:1.00]
+; SLM-NEXT:    shlw $7, %di # sched: [1:1.00]
+; SLM-NEXT:    shrw $7, %di # sched: [1:1.00]
+; SLM-NEXT:    sarw $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shlw $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrw $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    sarw %cl, %di # sched: [1:1.00]
+; SLM-NEXT:    shlw %cl, %di # sched: [1:1.00]
+; SLM-NEXT:    shrw %cl, %di # sched: [1:1.00]
+; SLM-NEXT:    sarw %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shlw %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrw %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sbb_16:
+; SANDY-LABEL: test_sar_shl_shr_16:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; SANDY-NEXT:    # sched: [1:0.33]
-; SANDY-NEXT:    sbbw $511, %di # imm = 0x1FF
-; SANDY-NEXT:    # sched: [2:0.67]
-; SANDY-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; SANDY-NEXT:    # sched: [9:1.00]
-; SANDY-NEXT:    sbbw $7, %di # sched: [2:0.67]
-; SANDY-NEXT:    sbbw $7, (%rsi) # sched: [9:1.00]
-; SANDY-NEXT:    sbbw %di, %di # sched: [2:0.67]
-; SANDY-NEXT:    sbbw %di, (%rsi) # sched: [9:1.00]
-; SANDY-NEXT:    sbbw (%rsi), %di # sched: [7:0.67]
+; SANDY-NEXT:    sarw %di # sched: [1:0.50]
+; SANDY-NEXT:    shlw %di # sched: [1:0.50]
+; SANDY-NEXT:    shrw %di # sched: [1:0.50]
+; SANDY-NEXT:    sarw (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    shlw (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shrw (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    sarw $7, %di # sched: [1:0.50]
+; SANDY-NEXT:    shlw $7, %di # sched: [1:0.50]
+; SANDY-NEXT:    shrw $7, %di # sched: [1:0.50]
+; SANDY-NEXT:    sarw $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shlw $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shrw $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    sarw %cl, %di # sched: [3:1.50]
+; SANDY-NEXT:    shlw %cl, %di # sched: [3:1.50]
+; SANDY-NEXT:    shrw %cl, %di # sched: [3:1.50]
+; SANDY-NEXT:    sarw %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    shlw %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    shrw %cl, (%rdx) # sched: [9:1.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sbb_16:
+; HASWELL-LABEL: test_sar_shl_shr_16:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; HASWELL-NEXT:    # sched: [1:0.25]
-; HASWELL-NEXT:    sbbw $511, %di # imm = 0x1FF
-; HASWELL-NEXT:    # sched: [2:0.50]
-; HASWELL-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; HASWELL-NEXT:    # sched: [9:1.00]
-; HASWELL-NEXT:    sbbw $7, %di # sched: [2:0.50]
-; HASWELL-NEXT:    sbbw $7, (%rsi) # sched: [9:1.00]
-; HASWELL-NEXT:    sbbw %di, %di # sched: [2:0.50]
-; HASWELL-NEXT:    sbbw %di, (%rsi) # sched: [9:1.00]
-; HASWELL-NEXT:    sbbw (%rsi), %di # sched: [7:0.50]
+; HASWELL-NEXT:    sarw %di # sched: [1:0.50]
+; HASWELL-NEXT:    shlw %di # sched: [1:0.50]
+; HASWELL-NEXT:    shrw %di # sched: [1:0.50]
+; HASWELL-NEXT:    sarw (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shlw (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shrw (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    sarw $7, %di # sched: [1:0.50]
+; HASWELL-NEXT:    shlw $7, %di # sched: [1:0.50]
+; HASWELL-NEXT:    shrw $7, %di # sched: [1:0.50]
+; HASWELL-NEXT:    sarw $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shlw $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shrw $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    sarw %cl, %di # sched: [3:1.00]
+; HASWELL-NEXT:    shlw %cl, %di # sched: [3:1.00]
+; HASWELL-NEXT:    shrw %cl, %di # sched: [3:1.00]
+; HASWELL-NEXT:    sarw %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    shlw %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    shrw %cl, (%rdx) # sched: [9:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sbb_16:
+; BROADWELL-LABEL: test_sar_shl_shr_16:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; BROADWELL-NEXT:    # sched: [1:0.25]
-; BROADWELL-NEXT:    sbbw $511, %di # imm = 0x1FF
-; BROADWELL-NEXT:    # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; BROADWELL-NEXT:    # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbw $7, %di # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbw $7, (%rsi) # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbw %di, %di # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbw %di, (%rsi) # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbw (%rsi), %di # sched: [6:0.50]
+; BROADWELL-NEXT:    sarw %di # sched: [1:0.50]
+; BROADWELL-NEXT:    shlw %di # sched: [1:0.50]
+; BROADWELL-NEXT:    shrw %di # sched: [1:0.50]
+; BROADWELL-NEXT:    sarw (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shlw (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shrw (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    sarw $7, %di # sched: [1:0.50]
+; BROADWELL-NEXT:    shlw $7, %di # sched: [1:0.50]
+; BROADWELL-NEXT:    shrw $7, %di # sched: [1:0.50]
+; BROADWELL-NEXT:    sarw $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shlw $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shrw $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    sarw %cl, %di # sched: [3:1.00]
+; BROADWELL-NEXT:    shlw %cl, %di # sched: [3:1.00]
+; BROADWELL-NEXT:    shrw %cl, %di # sched: [3:1.00]
+; BROADWELL-NEXT:    sarw %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    shlw %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    shrw %cl, (%rdx) # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sbb_16:
+; SKYLAKE-LABEL: test_sar_shl_shr_16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; SKYLAKE-NEXT:    # sched: [1:0.25]
-; SKYLAKE-NEXT:    sbbw $511, %di # imm = 0x1FF
-; SKYLAKE-NEXT:    # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; SKYLAKE-NEXT:    # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbw $7, %di # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbw $7, (%rsi) # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbw %di, %di # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbw %di, (%rsi) # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbw (%rsi), %di # sched: [6:0.50]
+; SKYLAKE-NEXT:    sarw %di # sched: [1:0.50]
+; SKYLAKE-NEXT:    shlw %di # sched: [1:0.50]
+; SKYLAKE-NEXT:    shrw %di # sched: [1:0.50]
+; SKYLAKE-NEXT:    sarw (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shlw (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrw (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    sarw $7, %di # sched: [1:0.50]
+; SKYLAKE-NEXT:    shlw $7, %di # sched: [1:0.50]
+; SKYLAKE-NEXT:    shrw $7, %di # sched: [1:0.50]
+; SKYLAKE-NEXT:    sarw $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shlw $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrw $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    sarw %cl, %di # sched: [3:1.50]
+; SKYLAKE-NEXT:    shlw %cl, %di # sched: [3:1.50]
+; SKYLAKE-NEXT:    shrw %cl, %di # sched: [3:1.50]
+; SKYLAKE-NEXT:    sarw %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    shlw %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    shrw %cl, (%rdx) # sched: [8:1.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sbb_16:
+; SKX-LABEL: test_sar_shl_shr_16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; SKX-NEXT:    # sched: [1:0.25]
-; SKX-NEXT:    sbbw $511, %di # imm = 0x1FF
-; SKX-NEXT:    # sched: [1:0.50]
-; SKX-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; SKX-NEXT:    # sched: [8:1.00]
-; SKX-NEXT:    sbbw $7, %di # sched: [1:0.50]
-; SKX-NEXT:    sbbw $7, (%rsi) # sched: [8:1.00]
-; SKX-NEXT:    sbbw %di, %di # sched: [1:0.50]
-; SKX-NEXT:    sbbw %di, (%rsi) # sched: [8:1.00]
-; SKX-NEXT:    sbbw (%rsi), %di # sched: [6:0.50]
+; SKX-NEXT:    sarw %di # sched: [1:0.50]
+; SKX-NEXT:    shlw %di # sched: [1:0.50]
+; SKX-NEXT:    shrw %di # sched: [1:0.50]
+; SKX-NEXT:    sarw (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shlw (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shrw (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    sarw $7, %di # sched: [1:0.50]
+; SKX-NEXT:    shlw $7, %di # sched: [1:0.50]
+; SKX-NEXT:    shrw $7, %di # sched: [1:0.50]
+; SKX-NEXT:    sarw $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shlw $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shrw $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    sarw %cl, %di # sched: [3:1.50]
+; SKX-NEXT:    shlw %cl, %di # sched: [3:1.50]
+; SKX-NEXT:    shrw %cl, %di # sched: [3:1.50]
+; SKX-NEXT:    sarw %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    shlw %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    shrw %cl, (%rdx) # sched: [8:1.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sbb_16:
+; BTVER2-LABEL: test_sar_shl_shr_16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    sbbw $511, %di # imm = 0x1FF
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; BTVER2-NEXT:    # sched: [4:1.00]
-; BTVER2-NEXT:    sbbw $7, %di # sched: [1:0.50]
-; BTVER2-NEXT:    sbbw $7, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    sbbw %di, %di # sched: [1:0.50]
-; BTVER2-NEXT:    sbbw %di, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    sbbw (%rsi), %di # sched: [4:1.00]
-; BTVER2-NEXT:    #NO_APP
-; BTVER2-NEXT:    retq # sched: [4:1.00]
-;
-; ZNVER1-LABEL: test_sbb_16:
-; ZNVER1:       # %bb.0:
-; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    sbbw $511, %ax # imm = 0x1FF
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbw $511, %di # imm = 0x1FF
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
-; ZNVER1-NEXT:    # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbw $7, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbw $7, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbw %di, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbw %di, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbw (%rsi), %di # sched: [5:0.50]
+; BTVER2-NEXT:    sarw %di # sched: [1:0.50]
+; BTVER2-NEXT:    shlw %di # sched: [1:0.50]
+; BTVER2-NEXT:    shrw %di # sched: [1:0.50]
+; BTVER2-NEXT:    sarw (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shlw (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrw (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    sarw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    shlw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    shrw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    sarw $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shlw $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrw $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    sarw %cl, %di # sched: [1:0.50]
+; BTVER2-NEXT:    shlw %cl, %di # sched: [1:0.50]
+; BTVER2-NEXT:    shrw %cl, %di # sched: [1:0.50]
+; BTVER2-NEXT:    sarw %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shlw %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrw %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_sar_shl_shr_16:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    sarw %di # sched: [1:0.25]
+; ZNVER1-NEXT:    shlw %di # sched: [1:0.25]
+; ZNVER1-NEXT:    shrw %di # sched: [1:0.25]
+; ZNVER1-NEXT:    sarw (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shlw (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrw (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    sarw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    shlw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    shrw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    sarw $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shlw $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrw $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    sarw %cl, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    shlw %cl, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    shrw %cl, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    sarw %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    shlw %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    shrw %cl, (%rdx) # sched: [5:1.00]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "sbbw $2, %AX \0A\09 sbbw $2, $0 \0A\09 sbbw $2, $1 \0A\09 sbbw $3, $0 \0A\09 sbbw $3, $1 \0A\09 sbbw $0, $0 \0A\09 sbbw $0, $1 \0A\09 sbbw $1, $0", "r,*m,i,i"(i16 %a0, i16* %a1, i16 511, i8 7) nounwind
+  call void asm sideeffect "sarw $0 \0A\09 shlw $0 \0A\09 shrw $0 \0A\09 sarw $2 \0A\09 shlw $2 \0A\09 shrw $2 \0A\09 sarw $3, $0 \0A\09 shlw $3, $0 \0A\09 shrw $3, $0 \0A\09 sarw $3, $2 \0A\09 shlw $3, $2 \0A\09 shrw $3, $2 \0A\09 sarw %CL, $0 \0A\09 shlw %CL, $0 \0A\09 shrw %CL, $0 \0A\09 sarw %CL, $2  \0A\09 shlw %CL, $2 \0A\09 shrw %CL, $2", "r,r,*m,i"(i16 %a0, i16 %a1, i16 *%a2, i8 7)
   ret void
 }
-define void @test_sbb_32(i32 %a0, i32* %a1) optsize {
-; GENERIC-LABEL: test_sbb_32:
+define void @test_sar_shl_shr_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
+; GENERIC-LABEL: test_sar_shl_shr_32:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [1:0.33]
-; GENERIC-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [2:0.67]
-; GENERIC-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [9:1.00]
-; GENERIC-NEXT:    sbbl $7, %edi # sched: [2:0.67]
-; GENERIC-NEXT:    sbbl $7, (%rsi) # sched: [9:1.00]
-; GENERIC-NEXT:    sbbl %edi, %edi # sched: [2:0.67]
-; GENERIC-NEXT:    sbbl %edi, (%rsi) # sched: [9:1.00]
-; GENERIC-NEXT:    sbbl (%rsi), %edi # sched: [7:0.67]
+; GENERIC-NEXT:    sarl %edi # sched: [1:0.50]
+; GENERIC-NEXT:    shll %edi # sched: [1:0.50]
+; GENERIC-NEXT:    shrl %edi # sched: [1:0.50]
+; GENERIC-NEXT:    sarl (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    shll (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shrl (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    sarl $7, %edi # sched: [1:0.50]
+; GENERIC-NEXT:    shll $7, %edi # sched: [1:0.50]
+; GENERIC-NEXT:    shrl $7, %edi # sched: [1:0.50]
+; GENERIC-NEXT:    sarl $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shll $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shrl $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    sarl %cl, %edi # sched: [3:1.50]
+; GENERIC-NEXT:    shll %cl, %edi # sched: [3:1.50]
+; GENERIC-NEXT:    shrl %cl, %edi # sched: [3:1.50]
+; GENERIC-NEXT:    sarl %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    shll %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    shrl %cl, (%rdx) # sched: [9:1.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sbb_32:
+; ATOM-LABEL: test_sar_shl_shr_32:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:1.00]
-; ATOM-NEXT:    sbbl $7, %edi # sched: [1:0.50]
-; ATOM-NEXT:    sbbl $7, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
-; ATOM-NEXT:    sbbl %edi, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    sbbl (%rsi), %edi # sched: [1:1.00]
+; ATOM-NEXT:    sarl %edi # sched: [1:1.00]
+; ATOM-NEXT:    shll %edi # sched: [1:1.00]
+; ATOM-NEXT:    shrl %edi # sched: [1:1.00]
+; ATOM-NEXT:    sarl (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shll (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrl (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    sarl $7, %edi # sched: [1:1.00]
+; ATOM-NEXT:    shll $7, %edi # sched: [1:1.00]
+; ATOM-NEXT:    shrl $7, %edi # sched: [1:1.00]
+; ATOM-NEXT:    sarl $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shll $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrl $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    sarl %cl, %edi # sched: [1:1.00]
+; ATOM-NEXT:    shll %cl, %edi # sched: [1:1.00]
+; ATOM-NEXT:    shrl %cl, %edi # sched: [1:1.00]
+; ATOM-NEXT:    sarl %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shll %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrl %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sbb_32:
+; SLM-LABEL: test_sar_shl_shr_32:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; SLM-NEXT:    # sched: [4:2.00]
-; SLM-NEXT:    sbbl $7, %edi # sched: [1:0.50]
-; SLM-NEXT:    sbbl $7, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
-; SLM-NEXT:    sbbl %edi, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    sbbl (%rsi), %edi # sched: [4:1.00]
+; SLM-NEXT:    sarl %edi # sched: [1:1.00]
+; SLM-NEXT:    shll %edi # sched: [1:1.00]
+; SLM-NEXT:    shrl %edi # sched: [1:1.00]
+; SLM-NEXT:    sarl (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shll (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrl (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    sarl $7, %edi # sched: [1:1.00]
+; SLM-NEXT:    shll $7, %edi # sched: [1:1.00]
+; SLM-NEXT:    shrl $7, %edi # sched: [1:1.00]
+; SLM-NEXT:    sarl $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shll $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrl $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    sarl %cl, %edi # sched: [1:1.00]
+; SLM-NEXT:    shll %cl, %edi # sched: [1:1.00]
+; SLM-NEXT:    shrl %cl, %edi # sched: [1:1.00]
+; SLM-NEXT:    sarl %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shll %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrl %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sbb_32:
+; SANDY-LABEL: test_sar_shl_shr_32:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [1:0.33]
-; SANDY-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [2:0.67]
-; SANDY-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [9:1.00]
-; SANDY-NEXT:    sbbl $7, %edi # sched: [2:0.67]
-; SANDY-NEXT:    sbbl $7, (%rsi) # sched: [9:1.00]
-; SANDY-NEXT:    sbbl %edi, %edi # sched: [2:0.67]
-; SANDY-NEXT:    sbbl %edi, (%rsi) # sched: [9:1.00]
-; SANDY-NEXT:    sbbl (%rsi), %edi # sched: [7:0.67]
+; SANDY-NEXT:    sarl %edi # sched: [1:0.50]
+; SANDY-NEXT:    shll %edi # sched: [1:0.50]
+; SANDY-NEXT:    shrl %edi # sched: [1:0.50]
+; SANDY-NEXT:    sarl (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    shll (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shrl (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    sarl $7, %edi # sched: [1:0.50]
+; SANDY-NEXT:    shll $7, %edi # sched: [1:0.50]
+; SANDY-NEXT:    shrl $7, %edi # sched: [1:0.50]
+; SANDY-NEXT:    sarl $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shll $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shrl $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    sarl %cl, %edi # sched: [3:1.50]
+; SANDY-NEXT:    shll %cl, %edi # sched: [3:1.50]
+; SANDY-NEXT:    shrl %cl, %edi # sched: [3:1.50]
+; SANDY-NEXT:    sarl %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    shll %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    shrl %cl, (%rdx) # sched: [9:1.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sbb_32:
+; HASWELL-LABEL: test_sar_shl_shr_32:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [1:0.25]
-; HASWELL-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [2:0.50]
-; HASWELL-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [9:1.00]
-; HASWELL-NEXT:    sbbl $7, %edi # sched: [2:0.50]
-; HASWELL-NEXT:    sbbl $7, (%rsi) # sched: [9:1.00]
-; HASWELL-NEXT:    sbbl %edi, %edi # sched: [2:0.50]
-; HASWELL-NEXT:    sbbl %edi, (%rsi) # sched: [9:1.00]
-; HASWELL-NEXT:    sbbl (%rsi), %edi # sched: [7:0.50]
+; HASWELL-NEXT:    sarl %edi # sched: [1:0.50]
+; HASWELL-NEXT:    shll %edi # sched: [1:0.50]
+; HASWELL-NEXT:    shrl %edi # sched: [1:0.50]
+; HASWELL-NEXT:    sarl (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shll (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shrl (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    sarl $7, %edi # sched: [1:0.50]
+; HASWELL-NEXT:    shll $7, %edi # sched: [1:0.50]
+; HASWELL-NEXT:    shrl $7, %edi # sched: [1:0.50]
+; HASWELL-NEXT:    sarl $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shll $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shrl $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    sarl %cl, %edi # sched: [3:1.00]
+; HASWELL-NEXT:    shll %cl, %edi # sched: [3:1.00]
+; HASWELL-NEXT:    shrl %cl, %edi # sched: [3:1.00]
+; HASWELL-NEXT:    sarl %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    shll %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    shrl %cl, (%rdx) # sched: [9:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sbb_32:
+; BROADWELL-LABEL: test_sar_shl_shr_32:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [1:0.25]
-; BROADWELL-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbl $7, %edi # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbl $7, (%rsi) # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbl %edi, (%rsi) # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbl (%rsi), %edi # sched: [6:0.50]
+; BROADWELL-NEXT:    sarl %edi # sched: [1:0.50]
+; BROADWELL-NEXT:    shll %edi # sched: [1:0.50]
+; BROADWELL-NEXT:    shrl %edi # sched: [1:0.50]
+; BROADWELL-NEXT:    sarl (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shll (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shrl (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    sarl $7, %edi # sched: [1:0.50]
+; BROADWELL-NEXT:    shll $7, %edi # sched: [1:0.50]
+; BROADWELL-NEXT:    shrl $7, %edi # sched: [1:0.50]
+; BROADWELL-NEXT:    sarl $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shll $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shrl $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    sarl %cl, %edi # sched: [3:1.00]
+; BROADWELL-NEXT:    shll %cl, %edi # sched: [3:1.00]
+; BROADWELL-NEXT:    shrl %cl, %edi # sched: [3:1.00]
+; BROADWELL-NEXT:    sarl %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    shll %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    shrl %cl, (%rdx) # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sbb_32:
+; SKYLAKE-LABEL: test_sar_shl_shr_32:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [1:0.25]
-; SKYLAKE-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbl $7, %edi # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbl $7, (%rsi) # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbl %edi, (%rsi) # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbl (%rsi), %edi # sched: [6:0.50]
-; SKYLAKE-NEXT:    #NO_APP
-; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+; SKYLAKE-NEXT:    sarl %edi # sched: [1:0.50]
+; SKYLAKE-NEXT:    shll %edi # sched: [1:0.50]
+; SKYLAKE-NEXT:    shrl %edi # sched: [1:0.50]
+; SKYLAKE-NEXT:    sarl (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shll (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrl (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    sarl $7, %edi # sched: [1:0.50]
+; SKYLAKE-NEXT:    shll $7, %edi # sched: [1:0.50]
+; SKYLAKE-NEXT:    shrl $7, %edi # sched: [1:0.50]
+; SKYLAKE-NEXT:    sarl $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shll $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrl $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    sarl %cl, %edi # sched: [3:1.50]
+; SKYLAKE-NEXT:    shll %cl, %edi # sched: [3:1.50]
+; SKYLAKE-NEXT:    shrl %cl, %edi # sched: [3:1.50]
+; SKYLAKE-NEXT:    sarl %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    shll %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    shrl %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sbb_32:
+; SKX-LABEL: test_sar_shl_shr_32:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; SKX-NEXT:    # sched: [1:0.25]
-; SKX-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; SKX-NEXT:    # sched: [1:0.50]
-; SKX-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; SKX-NEXT:    # sched: [8:1.00]
-; SKX-NEXT:    sbbl $7, %edi # sched: [1:0.50]
-; SKX-NEXT:    sbbl $7, (%rsi) # sched: [8:1.00]
-; SKX-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
-; SKX-NEXT:    sbbl %edi, (%rsi) # sched: [8:1.00]
-; SKX-NEXT:    sbbl (%rsi), %edi # sched: [6:0.50]
+; SKX-NEXT:    sarl %edi # sched: [1:0.50]
+; SKX-NEXT:    shll %edi # sched: [1:0.50]
+; SKX-NEXT:    shrl %edi # sched: [1:0.50]
+; SKX-NEXT:    sarl (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shll (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shrl (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    sarl $7, %edi # sched: [1:0.50]
+; SKX-NEXT:    shll $7, %edi # sched: [1:0.50]
+; SKX-NEXT:    shrl $7, %edi # sched: [1:0.50]
+; SKX-NEXT:    sarl $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shll $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shrl $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    sarl %cl, %edi # sched: [3:1.50]
+; SKX-NEXT:    shll %cl, %edi # sched: [3:1.50]
+; SKX-NEXT:    shrl %cl, %edi # sched: [3:1.50]
+; SKX-NEXT:    sarl %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    shll %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    shrl %cl, (%rdx) # sched: [8:1.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sbb_32:
+; BTVER2-LABEL: test_sar_shl_shr_32:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [4:1.00]
-; BTVER2-NEXT:    sbbl $7, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    sbbl $7, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    sbbl %edi, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    sbbl (%rsi), %edi # sched: [4:1.00]
+; BTVER2-NEXT:    sarl %edi # sched: [1:0.50]
+; BTVER2-NEXT:    shll %edi # sched: [1:0.50]
+; BTVER2-NEXT:    shrl %edi # sched: [1:0.50]
+; BTVER2-NEXT:    sarl (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shll (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrl (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    sarl $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    shll $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    shrl $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    sarl $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shll $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrl $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    sarl %cl, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    shll %cl, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    shrl %cl, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    sarl %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shll %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrl %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sbb_32:
+; ZNVER1-LABEL: test_sar_shl_shr_32:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbl $7, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbl $7, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbl %edi, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbl %edi, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbl (%rsi), %edi # sched: [5:0.50]
+; ZNVER1-NEXT:    sarl %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    shll %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    shrl %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    sarl (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shll (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrl (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    sarl $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    shll $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    shrl $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    sarl $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shll $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrl $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    sarl %cl, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    shll %cl, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    shrl %cl, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    sarl %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    shll %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    shrl %cl, (%rdx) # sched: [5:1.00]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "sbbl $2, %EAX \0A\09 sbbl $2, $0 \0A\09 sbbl $2, $1 \0A\09 sbbl $3, $0 \0A\09 sbbl $3, $1 \0A\09 sbbl $0, $0 \0A\09 sbbl $0, $1 \0A\09 sbbl $1, $0", "r,*m,i,i"(i32 %a0, i32* %a1, i32 665536, i8 7) nounwind
+  call void asm sideeffect "sarl $0 \0A\09 shll $0 \0A\09 shrl $0 \0A\09 sarl $2 \0A\09 shll $2 \0A\09 shrl $2 \0A\09 sarl $3, $0 \0A\09 shll $3, $0 \0A\09 shrl $3, $0 \0A\09 sarl $3, $2 \0A\09 shll $3, $2 \0A\09 shrl $3, $2 \0A\09 sarl %CL, $0 \0A\09 shll %CL, $0 \0A\09 shrl %CL, $0 \0A\09 sarl %CL, $2  \0A\09 shll %CL, $2 \0A\09 shrl %CL, $2", "r,r,*m,i"(i32 %a0, i32 %a1, i32 *%a2, i8 7)
   ret void
 }
-define void @test_sbb_64(i64 %a0, i64* %a1) optsize {
-; GENERIC-LABEL: test_sbb_64:
+define void @test_sar_shl_shr_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
+; GENERIC-LABEL: test_sar_shl_shr_64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [1:0.33]
-; GENERIC-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [2:0.67]
-; GENERIC-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [9:1.00]
-; GENERIC-NEXT:    sbbq $7, %rdi # sched: [2:0.67]
-; GENERIC-NEXT:    sbbq $7, (%rsi) # sched: [9:1.00]
-; GENERIC-NEXT:    sbbq %rdi, %rdi # sched: [2:0.67]
-; GENERIC-NEXT:    sbbq %rdi, (%rsi) # sched: [9:1.00]
-; GENERIC-NEXT:    sbbq (%rsi), %rdi # sched: [7:0.67]
+; GENERIC-NEXT:    sarq %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    shlq %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    shrq %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    sarq (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    shlq (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shrq (%rdx) # sched: [5:1.00]
+; GENERIC-NEXT:    sarq $7, %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    shlq $7, %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    shrq $7, %rdi # sched: [1:0.50]
+; GENERIC-NEXT:    sarq $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shlq $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    shrq $7, (%rdx) # sched: [7:1.00]
+; GENERIC-NEXT:    sarq %cl, %rdi # sched: [3:1.50]
+; GENERIC-NEXT:    shlq %cl, %rdi # sched: [3:1.50]
+; GENERIC-NEXT:    shrq %cl, %rdi # sched: [3:1.50]
+; GENERIC-NEXT:    sarq %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    shlq %cl, (%rdx) # sched: [9:1.50]
+; GENERIC-NEXT:    shrq %cl, (%rdx) # sched: [9:1.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sbb_64:
+; ATOM-LABEL: test_sar_shl_shr_64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:1.00]
-; ATOM-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
-; ATOM-NEXT:    sbbq $7, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
-; ATOM-NEXT:    sbbq %rdi, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    sbbq (%rsi), %rdi # sched: [1:1.00]
+; ATOM-NEXT:    sarq %rdi # sched: [1:1.00]
+; ATOM-NEXT:    shlq %rdi # sched: [1:1.00]
+; ATOM-NEXT:    shrq %rdi # sched: [1:1.00]
+; ATOM-NEXT:    sarq (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shlq (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrq (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    sarq $7, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    shlq $7, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    shrq $7, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    sarq $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shlq $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrq $7, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    sarq %cl, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    shlq %cl, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    shrq %cl, %rdi # sched: [1:1.00]
+; ATOM-NEXT:    sarq %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shlq %cl, (%rdx) # sched: [1:1.00]
+; ATOM-NEXT:    shrq %cl, (%rdx) # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sbb_64:
+; SLM-LABEL: test_sar_shl_shr_64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; SLM-NEXT:    # sched: [4:2.00]
-; SLM-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
-; SLM-NEXT:    sbbq $7, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
-; SLM-NEXT:    sbbq %rdi, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    sbbq (%rsi), %rdi # sched: [4:1.00]
+; SLM-NEXT:    sarq %rdi # sched: [1:1.00]
+; SLM-NEXT:    shlq %rdi # sched: [1:1.00]
+; SLM-NEXT:    shrq %rdi # sched: [1:1.00]
+; SLM-NEXT:    sarq (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shlq (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrq (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    sarq $7, %rdi # sched: [1:1.00]
+; SLM-NEXT:    shlq $7, %rdi # sched: [1:1.00]
+; SLM-NEXT:    shrq $7, %rdi # sched: [1:1.00]
+; SLM-NEXT:    sarq $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shlq $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrq $7, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    sarq %cl, %rdi # sched: [1:1.00]
+; SLM-NEXT:    shlq %cl, %rdi # sched: [1:1.00]
+; SLM-NEXT:    shrq %cl, %rdi # sched: [1:1.00]
+; SLM-NEXT:    sarq %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shlq %cl, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrq %cl, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sbb_64:
+; SANDY-LABEL: test_sar_shl_shr_64:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [1:0.33]
-; SANDY-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [2:0.67]
-; SANDY-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [9:1.00]
-; SANDY-NEXT:    sbbq $7, %rdi # sched: [2:0.67]
-; SANDY-NEXT:    sbbq $7, (%rsi) # sched: [9:1.00]
-; SANDY-NEXT:    sbbq %rdi, %rdi # sched: [2:0.67]
-; SANDY-NEXT:    sbbq %rdi, (%rsi) # sched: [9:1.00]
-; SANDY-NEXT:    sbbq (%rsi), %rdi # sched: [7:0.67]
+; SANDY-NEXT:    sarq %rdi # sched: [1:0.50]
+; SANDY-NEXT:    shlq %rdi # sched: [1:0.50]
+; SANDY-NEXT:    shrq %rdi # sched: [1:0.50]
+; SANDY-NEXT:    sarq (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    shlq (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shrq (%rdx) # sched: [5:1.00]
+; SANDY-NEXT:    sarq $7, %rdi # sched: [1:0.50]
+; SANDY-NEXT:    shlq $7, %rdi # sched: [1:0.50]
+; SANDY-NEXT:    shrq $7, %rdi # sched: [1:0.50]
+; SANDY-NEXT:    sarq $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shlq $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    shrq $7, (%rdx) # sched: [7:1.00]
+; SANDY-NEXT:    sarq %cl, %rdi # sched: [3:1.50]
+; SANDY-NEXT:    shlq %cl, %rdi # sched: [3:1.50]
+; SANDY-NEXT:    shrq %cl, %rdi # sched: [3:1.50]
+; SANDY-NEXT:    sarq %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    shlq %cl, (%rdx) # sched: [9:1.50]
+; SANDY-NEXT:    shrq %cl, (%rdx) # sched: [9:1.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sbb_64:
+; HASWELL-LABEL: test_sar_shl_shr_64:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [1:0.25]
-; HASWELL-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [2:0.50]
-; HASWELL-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [9:1.00]
-; HASWELL-NEXT:    sbbq $7, %rdi # sched: [2:0.50]
-; HASWELL-NEXT:    sbbq $7, (%rsi) # sched: [9:1.00]
-; HASWELL-NEXT:    sbbq %rdi, %rdi # sched: [2:0.50]
-; HASWELL-NEXT:    sbbq %rdi, (%rsi) # sched: [9:1.00]
-; HASWELL-NEXT:    sbbq (%rsi), %rdi # sched: [7:0.50]
-; HASWELL-NEXT:    #NO_APP
-; HASWELL-NEXT:    retq # sched: [7:1.00]
+; HASWELL-NEXT:    sarq %rdi # sched: [1:0.50]
+; HASWELL-NEXT:    shlq %rdi # sched: [1:0.50]
+; HASWELL-NEXT:    shrq %rdi # sched: [1:0.50]
+; HASWELL-NEXT:    sarq (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shlq (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shrq (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    sarq $7, %rdi # sched: [1:0.50]
+; HASWELL-NEXT:    shlq $7, %rdi # sched: [1:0.50]
+; HASWELL-NEXT:    shrq $7, %rdi # sched: [1:0.50]
+; HASWELL-NEXT:    sarq $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shlq $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    shrq $7, (%rdx) # sched: [7:1.00]
+; HASWELL-NEXT:    sarq %cl, %rdi # sched: [3:1.00]
+; HASWELL-NEXT:    shlq %cl, %rdi # sched: [3:1.00]
+; HASWELL-NEXT:    shrq %cl, %rdi # sched: [3:1.00]
+; HASWELL-NEXT:    sarq %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    shlq %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    shrq %cl, (%rdx) # sched: [9:1.00]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sbb_64:
+; BROADWELL-LABEL: test_sar_shl_shr_64:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [1:0.25]
-; BROADWELL-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbq $7, (%rsi) # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
-; BROADWELL-NEXT:    sbbq %rdi, (%rsi) # sched: [8:1.00]
-; BROADWELL-NEXT:    sbbq (%rsi), %rdi # sched: [6:0.50]
+; BROADWELL-NEXT:    sarq %rdi # sched: [1:0.50]
+; BROADWELL-NEXT:    shlq %rdi # sched: [1:0.50]
+; BROADWELL-NEXT:    shrq %rdi # sched: [1:0.50]
+; BROADWELL-NEXT:    sarq (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shlq (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shrq (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    sarq $7, %rdi # sched: [1:0.50]
+; BROADWELL-NEXT:    shlq $7, %rdi # sched: [1:0.50]
+; BROADWELL-NEXT:    shrq $7, %rdi # sched: [1:0.50]
+; BROADWELL-NEXT:    sarq $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shlq $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    shrq $7, (%rdx) # sched: [6:1.00]
+; BROADWELL-NEXT:    sarq %cl, %rdi # sched: [3:1.00]
+; BROADWELL-NEXT:    shlq %cl, %rdi # sched: [3:1.00]
+; BROADWELL-NEXT:    shrq %cl, %rdi # sched: [3:1.00]
+; BROADWELL-NEXT:    sarq %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    shlq %cl, (%rdx) # sched: [8:1.00]
+; BROADWELL-NEXT:    shrq %cl, (%rdx) # sched: [8:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sbb_64:
+; SKYLAKE-LABEL: test_sar_shl_shr_64:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [1:0.25]
-; SKYLAKE-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbq $7, (%rsi) # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
-; SKYLAKE-NEXT:    sbbq %rdi, (%rsi) # sched: [8:1.00]
-; SKYLAKE-NEXT:    sbbq (%rsi), %rdi # sched: [6:0.50]
+; SKYLAKE-NEXT:    sarq %rdi # sched: [1:0.50]
+; SKYLAKE-NEXT:    shlq %rdi # sched: [1:0.50]
+; SKYLAKE-NEXT:    shrq %rdi # sched: [1:0.50]
+; SKYLAKE-NEXT:    sarq (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shlq (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrq (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    sarq $7, %rdi # sched: [1:0.50]
+; SKYLAKE-NEXT:    shlq $7, %rdi # sched: [1:0.50]
+; SKYLAKE-NEXT:    shrq $7, %rdi # sched: [1:0.50]
+; SKYLAKE-NEXT:    sarq $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shlq $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrq $7, (%rdx) # sched: [6:1.00]
+; SKYLAKE-NEXT:    sarq %cl, %rdi # sched: [3:1.50]
+; SKYLAKE-NEXT:    shlq %cl, %rdi # sched: [3:1.50]
+; SKYLAKE-NEXT:    shrq %cl, %rdi # sched: [3:1.50]
+; SKYLAKE-NEXT:    sarq %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    shlq %cl, (%rdx) # sched: [8:1.50]
+; SKYLAKE-NEXT:    shrq %cl, (%rdx) # sched: [8:1.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sbb_64:
+; SKX-LABEL: test_sar_shl_shr_64:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; SKX-NEXT:    # sched: [1:0.25]
-; SKX-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; SKX-NEXT:    # sched: [1:0.50]
-; SKX-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; SKX-NEXT:    # sched: [8:1.00]
-; SKX-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
-; SKX-NEXT:    sbbq $7, (%rsi) # sched: [8:1.00]
-; SKX-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
-; SKX-NEXT:    sbbq %rdi, (%rsi) # sched: [8:1.00]
-; SKX-NEXT:    sbbq (%rsi), %rdi # sched: [6:0.50]
+; SKX-NEXT:    sarq %rdi # sched: [1:0.50]
+; SKX-NEXT:    shlq %rdi # sched: [1:0.50]
+; SKX-NEXT:    shrq %rdi # sched: [1:0.50]
+; SKX-NEXT:    sarq (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shlq (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shrq (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    sarq $7, %rdi # sched: [1:0.50]
+; SKX-NEXT:    shlq $7, %rdi # sched: [1:0.50]
+; SKX-NEXT:    shrq $7, %rdi # sched: [1:0.50]
+; SKX-NEXT:    sarq $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shlq $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    shrq $7, (%rdx) # sched: [6:1.00]
+; SKX-NEXT:    sarq %cl, %rdi # sched: [3:1.50]
+; SKX-NEXT:    shlq %cl, %rdi # sched: [3:1.50]
+; SKX-NEXT:    shrq %cl, %rdi # sched: [3:1.50]
+; SKX-NEXT:    sarq %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    shlq %cl, (%rdx) # sched: [8:1.50]
+; SKX-NEXT:    shrq %cl, (%rdx) # sched: [8:1.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sbb_64:
+; BTVER2-LABEL: test_sar_shl_shr_64:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [4:1.00]
-; BTVER2-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    sbbq $7, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    sbbq %rdi, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    sbbq (%rsi), %rdi # sched: [4:1.00]
+; BTVER2-NEXT:    sarq %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    shlq %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    shrq %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    sarq (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shlq (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrq (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    sarq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    shlq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    shrq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    sarq $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shlq $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrq $7, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    sarq %cl, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    shlq %cl, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    shrq %cl, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    sarq %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shlq %cl, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    shrq %cl, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sbb_64:
+; ZNVER1-LABEL: test_sar_shl_shr_64:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbq $7, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbq $7, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbq %rdi, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    sbbq %rdi, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    sbbq (%rsi), %rdi # sched: [5:0.50]
+; ZNVER1-NEXT:    sarq %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    shlq %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    shrq %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    sarq (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shlq (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrq (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    sarq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    shlq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    shrq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    sarq $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shlq $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrq $7, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    sarq %cl, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    shlq %cl, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    shrq %cl, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    sarq %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    shlq %cl, (%rdx) # sched: [5:1.00]
+; ZNVER1-NEXT:    shrq %cl, (%rdx) # sched: [5:1.00]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "sbbq $2, %RAX \0A\09 sbbq $2, $0 \0A\09 sbbq $2, $1 \0A\09 sbbq $3, $0 \0A\09 sbbq $3, $1 \0A\09 sbbq $0, $0 \0A\09 sbbq $0, $1 \0A\09 sbbq $1, $0", "r,*m,i,i"(i64 %a0, i64* %a1, i32 665536, i8 7) nounwind
+  call void asm sideeffect "sarq $0 \0A\09 shlq $0 \0A\09 shrq $0 \0A\09 sarq $2 \0A\09 shlq $2 \0A\09 shrq $2 \0A\09 sarq $3, $0 \0A\09 shlq $3, $0 \0A\09 shrq $3, $0 \0A\09 sarq $3, $2 \0A\09 shlq $3, $2 \0A\09 shrq $3, $2 \0A\09 sarq %CL, $0 \0A\09 shlq %CL, $0 \0A\09 shrq %CL, $0 \0A\09 sarq %CL, $2  \0A\09 shlq %CL, $2 \0A\09 shrq %CL, $2", "r,r,*m,i"(i64 %a0, i64 %a1, i64 *%a2, i8 7)
   ret void
 }
 
-define void @test_scas() optsize {
-; GENERIC-LABEL: test_scas:
+define void @test_sbb_8(i8 %a0, i8* %a1) optsize {
+; GENERIC-LABEL: test_sbb_8:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    scasb %es:(%rdi), %al # sched: [2:0.67]
-; GENERIC-NEXT:    scasw %es:(%rdi), %ax # sched: [2:0.67]
-; GENERIC-NEXT:    scasl %es:(%rdi), %eax # sched: [2:0.67]
-; GENERIC-NEXT:    scasq %es:(%rdi), %rax # sched: [2:0.67]
+; GENERIC-NEXT:    sbbb $7, %al # sched: [3:1.00]
+; GENERIC-NEXT:    sbbb $7, %dil # sched: [2:0.67]
+; GENERIC-NEXT:    sbbb $7, (%rsi) # sched: [9:1.00]
+; GENERIC-NEXT:    sbbb %dil, %dil # sched: [2:0.67]
+; GENERIC-NEXT:    sbbb %dil, (%rsi) # sched: [9:1.00]
+; GENERIC-NEXT:    sbbb (%rsi), %dil # sched: [7:0.67]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_scas:
+; ATOM-LABEL: test_sbb_8:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    scasb %es:(%rdi), %al # sched: [2:1.00]
-; ATOM-NEXT:    scasw %es:(%rdi), %ax # sched: [2:1.00]
-; ATOM-NEXT:    scasl %es:(%rdi), %eax # sched: [2:1.00]
-; ATOM-NEXT:    scasq %es:(%rdi), %rax # sched: [2:1.00]
+; ATOM-NEXT:    sbbb $7, %al # sched: [1:0.50]
+; ATOM-NEXT:    sbbb $7, %dil # sched: [1:0.50]
+; ATOM-NEXT:    sbbb $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
+; ATOM-NEXT:    sbbb %dil, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    sbbb (%rsi), %dil # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_scas:
+; SLM-LABEL: test_sbb_8:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    scasb %es:(%rdi), %al # sched: [100:1.00]
-; SLM-NEXT:    scasw %es:(%rdi), %ax # sched: [100:1.00]
-; SLM-NEXT:    scasl %es:(%rdi), %eax # sched: [100:1.00]
-; SLM-NEXT:    scasq %es:(%rdi), %rax # sched: [100:1.00]
+; SLM-NEXT:    sbbb $7, %al # sched: [1:0.50]
+; SLM-NEXT:    sbbb $7, %dil # sched: [1:0.50]
+; SLM-NEXT:    sbbb $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
+; SLM-NEXT:    sbbb %dil, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    sbbb (%rsi), %dil # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_scas:
+; SANDY-LABEL: test_sbb_8:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    scasb %es:(%rdi), %al # sched: [2:0.67]
-; SANDY-NEXT:    scasw %es:(%rdi), %ax # sched: [2:0.67]
-; SANDY-NEXT:    scasl %es:(%rdi), %eax # sched: [2:0.67]
-; SANDY-NEXT:    scasq %es:(%rdi), %rax # sched: [2:0.67]
+; SANDY-NEXT:    sbbb $7, %al # sched: [3:1.00]
+; SANDY-NEXT:    sbbb $7, %dil # sched: [2:0.67]
+; SANDY-NEXT:    sbbb $7, (%rsi) # sched: [9:1.00]
+; SANDY-NEXT:    sbbb %dil, %dil # sched: [2:0.67]
+; SANDY-NEXT:    sbbb %dil, (%rsi) # sched: [9:1.00]
+; SANDY-NEXT:    sbbb (%rsi), %dil # sched: [7:0.67]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_scas:
+; HASWELL-LABEL: test_sbb_8:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    scasb %es:(%rdi), %al # sched: [7:0.50]
-; HASWELL-NEXT:    scasw %es:(%rdi), %ax # sched: [7:0.50]
-; HASWELL-NEXT:    scasl %es:(%rdi), %eax # sched: [7:0.50]
-; HASWELL-NEXT:    scasq %es:(%rdi), %rax # sched: [7:0.50]
+; HASWELL-NEXT:    sbbb $7, %al # sched: [2:0.50]
+; HASWELL-NEXT:    sbbb $7, %dil # sched: [2:0.50]
+; HASWELL-NEXT:    sbbb $7, (%rsi) # sched: [9:1.00]
+; HASWELL-NEXT:    sbbb %dil, %dil # sched: [2:0.50]
+; HASWELL-NEXT:    sbbb %dil, (%rsi) # sched: [9:1.00]
+; HASWELL-NEXT:    sbbb (%rsi), %dil # sched: [7:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_scas:
+; BROADWELL-LABEL: test_sbb_8:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    scasb %es:(%rdi), %al # sched: [7:0.50]
-; BROADWELL-NEXT:    scasw %es:(%rdi), %ax # sched: [7:0.50]
-; BROADWELL-NEXT:    scasl %es:(%rdi), %eax # sched: [7:0.50]
-; BROADWELL-NEXT:    scasq %es:(%rdi), %rax # sched: [7:0.50]
+; BROADWELL-NEXT:    sbbb $7, %al # sched: [2:0.50]
+; BROADWELL-NEXT:    sbbb $7, %dil # sched: [2:0.50]
+; BROADWELL-NEXT:    sbbb $7, (%rsi) # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbb %dil, (%rsi) # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbb (%rsi), %dil # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_scas:
+; SKYLAKE-LABEL: test_sbb_8:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    scasb %es:(%rdi), %al # sched: [7:0.50]
-; SKYLAKE-NEXT:    scasw %es:(%rdi), %ax # sched: [7:0.50]
-; SKYLAKE-NEXT:    scasl %es:(%rdi), %eax # sched: [7:0.50]
-; SKYLAKE-NEXT:    scasq %es:(%rdi), %rax # sched: [7:0.50]
+; SKYLAKE-NEXT:    sbbb $7, %al # sched: [2:0.50]
+; SKYLAKE-NEXT:    sbbb $7, %dil # sched: [2:0.50]
+; SKYLAKE-NEXT:    sbbb $7, (%rsi) # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbb %dil, (%rsi) # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbb (%rsi), %dil # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_scas:
+; SKX-LABEL: test_sbb_8:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    scasb %es:(%rdi), %al # sched: [7:0.50]
-; SKX-NEXT:    scasw %es:(%rdi), %ax # sched: [7:0.50]
-; SKX-NEXT:    scasl %es:(%rdi), %eax # sched: [7:0.50]
-; SKX-NEXT:    scasq %es:(%rdi), %rax # sched: [7:0.50]
+; SKX-NEXT:    sbbb $7, %al # sched: [2:0.50]
+; SKX-NEXT:    sbbb $7, %dil # sched: [2:0.50]
+; SKX-NEXT:    sbbb $7, (%rsi) # sched: [8:1.00]
+; SKX-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
+; SKX-NEXT:    sbbb %dil, (%rsi) # sched: [8:1.00]
+; SKX-NEXT:    sbbb (%rsi), %dil # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_scas:
+; BTVER2-LABEL: test_sbb_8:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    scasb %es:(%rdi), %al # sched: [100:0.17]
-; BTVER2-NEXT:    scasw %es:(%rdi), %ax # sched: [100:0.17]
-; BTVER2-NEXT:    scasl %es:(%rdi), %eax # sched: [100:0.17]
-; BTVER2-NEXT:    scasq %es:(%rdi), %rax # sched: [100:0.17]
+; BTVER2-NEXT:    sbbb $7, %al # sched: [1:0.50]
+; BTVER2-NEXT:    sbbb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    sbbb $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    sbbb %dil, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    sbbb %dil, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    sbbb (%rsi), %dil # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_scas:
+; ZNVER1-LABEL: test_sbb_8:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    scasb %es:(%rdi), %al # sched: [100:?]
-; ZNVER1-NEXT:    scasw %es:(%rdi), %ax # sched: [100:?]
-; ZNVER1-NEXT:    scasl %es:(%rdi), %eax # sched: [100:?]
-; ZNVER1-NEXT:    scasq %es:(%rdi), %rax # sched: [100:?]
+; ZNVER1-NEXT:    sbbb $7, %al # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbb $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbb %dil, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbb %dil, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbb (%rsi), %dil # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "scasb \0A\09 scasw \0A\09 scasl \0A\09 scasq", ""()
+  tail call void asm "sbbb $2, %AL \0A\09 sbbb $2, $0 \0A\09 sbbb $2, $1 \0A\09 sbbb $0, $0 \0A\09 sbbb $0, $1 \0A\09 sbbb $1, $0", "r,*m,i"(i8 %a0, i8* %a1, i8 7) nounwind
   ret void
 }
-
-define void @test_setcc(i8 %a0, i8 *%a1) optsize {
-; GENERIC-LABEL: test_setcc:
+define void @test_sbb_16(i16 %a0, i16* %a1) optsize {
+; GENERIC-LABEL: test_sbb_16:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    seto %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setno %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setb %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setae %dil # sched: [1:0.50]
-; GENERIC-NEXT:    sete %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setne %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setbe %dil # sched: [2:1.00]
-; GENERIC-NEXT:    seta %dil # sched: [2:1.00]
-; GENERIC-NEXT:    sets %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setns %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setp %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setnp %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setl %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setge %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setle %dil # sched: [1:0.50]
-; GENERIC-NEXT:    setg %dil # sched: [1:0.50]
-; GENERIC-NEXT:    seto (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setno (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setb (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setae (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    sete (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setne (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setbe (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    seta (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    sets (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setns (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setp (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setnp (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setl (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setge (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setle (%rsi) # sched: [5:1.00]
-; GENERIC-NEXT:    setg (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    sbbw $511, %di # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [2:0.67]
+; GENERIC-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [9:1.00]
+; GENERIC-NEXT:    sbbw $7, %di # sched: [2:0.67]
+; GENERIC-NEXT:    sbbw $7, (%rsi) # sched: [9:1.00]
+; GENERIC-NEXT:    sbbw %di, %di # sched: [2:0.67]
+; GENERIC-NEXT:    sbbw %di, (%rsi) # sched: [9:1.00]
+; GENERIC-NEXT:    sbbw (%rsi), %di # sched: [7:0.67]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_setcc:
+; ATOM-LABEL: test_sbb_16:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    seto %dil # sched: [1:0.50]
-; ATOM-NEXT:    setno %dil # sched: [1:0.50]
-; ATOM-NEXT:    setb %dil # sched: [1:0.50]
-; ATOM-NEXT:    setae %dil # sched: [1:0.50]
-; ATOM-NEXT:    sete %dil # sched: [1:0.50]
-; ATOM-NEXT:    setne %dil # sched: [1:0.50]
-; ATOM-NEXT:    setbe %dil # sched: [1:0.50]
-; ATOM-NEXT:    seta %dil # sched: [1:0.50]
-; ATOM-NEXT:    sets %dil # sched: [1:0.50]
-; ATOM-NEXT:    setns %dil # sched: [1:0.50]
-; ATOM-NEXT:    setp %dil # sched: [1:0.50]
-; ATOM-NEXT:    setnp %dil # sched: [1:0.50]
-; ATOM-NEXT:    setl %dil # sched: [1:0.50]
-; ATOM-NEXT:    setge %dil # sched: [1:0.50]
-; ATOM-NEXT:    setle %dil # sched: [1:0.50]
-; ATOM-NEXT:    setg %dil # sched: [1:0.50]
-; ATOM-NEXT:    seto (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setno (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setb (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setae (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    sete (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setne (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setbe (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    seta (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    sets (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setns (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setp (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setnp (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setl (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setge (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setle (%rsi) # sched: [2:1.00]
-; ATOM-NEXT:    setg (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    sbbw $511, %di # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    sbbw $7, %di # sched: [1:0.50]
+; ATOM-NEXT:    sbbw $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    sbbw %di, %di # sched: [1:0.50]
+; ATOM-NEXT:    sbbw %di, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    sbbw (%rsi), %di # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_setcc:
+; SLM-LABEL: test_sbb_16:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    seto %dil # sched: [1:0.50]
-; SLM-NEXT:    setno %dil # sched: [1:0.50]
-; SLM-NEXT:    setb %dil # sched: [1:0.50]
-; SLM-NEXT:    setae %dil # sched: [1:0.50]
-; SLM-NEXT:    sete %dil # sched: [1:0.50]
-; SLM-NEXT:    setne %dil # sched: [1:0.50]
-; SLM-NEXT:    setbe %dil # sched: [1:0.50]
-; SLM-NEXT:    seta %dil # sched: [1:0.50]
-; SLM-NEXT:    sets %dil # sched: [1:0.50]
-; SLM-NEXT:    setns %dil # sched: [1:0.50]
-; SLM-NEXT:    setp %dil # sched: [1:0.50]
-; SLM-NEXT:    setnp %dil # sched: [1:0.50]
-; SLM-NEXT:    setl %dil # sched: [1:0.50]
-; SLM-NEXT:    setge %dil # sched: [1:0.50]
-; SLM-NEXT:    setle %dil # sched: [1:0.50]
-; SLM-NEXT:    setg %dil # sched: [1:0.50]
-; SLM-NEXT:    seto (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setno (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setb (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setae (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    sete (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setne (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setbe (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    seta (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    sets (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setns (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setp (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setnp (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setl (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setge (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setle (%rsi) # sched: [1:1.00]
-; SLM-NEXT:    setg (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    sbbw $511, %di # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    sbbw $7, %di # sched: [1:0.50]
+; SLM-NEXT:    sbbw $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    sbbw %di, %di # sched: [1:0.50]
+; SLM-NEXT:    sbbw %di, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    sbbw (%rsi), %di # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_setcc:
+; SANDY-LABEL: test_sbb_16:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    seto %dil # sched: [1:0.50]
-; SANDY-NEXT:    setno %dil # sched: [1:0.50]
-; SANDY-NEXT:    setb %dil # sched: [1:0.50]
-; SANDY-NEXT:    setae %dil # sched: [1:0.50]
-; SANDY-NEXT:    sete %dil # sched: [1:0.50]
-; SANDY-NEXT:    setne %dil # sched: [1:0.50]
-; SANDY-NEXT:    setbe %dil # sched: [2:1.00]
-; SANDY-NEXT:    seta %dil # sched: [2:1.00]
-; SANDY-NEXT:    sets %dil # sched: [1:0.50]
-; SANDY-NEXT:    setns %dil # sched: [1:0.50]
-; SANDY-NEXT:    setp %dil # sched: [1:0.50]
-; SANDY-NEXT:    setnp %dil # sched: [1:0.50]
-; SANDY-NEXT:    setl %dil # sched: [1:0.50]
-; SANDY-NEXT:    setge %dil # sched: [1:0.50]
-; SANDY-NEXT:    setle %dil # sched: [1:0.50]
-; SANDY-NEXT:    setg %dil # sched: [1:0.50]
-; SANDY-NEXT:    seto (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setno (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setb (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setae (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    sete (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setne (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setbe (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    seta (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    sets (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setns (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setp (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setnp (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setl (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setge (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setle (%rsi) # sched: [5:1.00]
-; SANDY-NEXT:    setg (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    sbbw $511, %di # imm = 0x1FF
+; SANDY-NEXT:    # sched: [2:0.67]
+; SANDY-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; SANDY-NEXT:    # sched: [9:1.00]
+; SANDY-NEXT:    sbbw $7, %di # sched: [2:0.67]
+; SANDY-NEXT:    sbbw $7, (%rsi) # sched: [9:1.00]
+; SANDY-NEXT:    sbbw %di, %di # sched: [2:0.67]
+; SANDY-NEXT:    sbbw %di, (%rsi) # sched: [9:1.00]
+; SANDY-NEXT:    sbbw (%rsi), %di # sched: [7:0.67]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_setcc:
+; HASWELL-LABEL: test_sbb_16:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    seto %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setno %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setb %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setae %dil # sched: [1:0.50]
-; HASWELL-NEXT:    sete %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setne %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setbe %dil # sched: [2:0.50]
-; HASWELL-NEXT:    seta %dil # sched: [2:0.50]
-; HASWELL-NEXT:    sets %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setns %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setp %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setnp %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setl %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setge %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setle %dil # sched: [1:0.50]
-; HASWELL-NEXT:    setg %dil # sched: [1:0.50]
-; HASWELL-NEXT:    seto (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setno (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setb (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setae (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    sete (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setne (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setbe (%rsi) # sched: [3:1.00]
-; HASWELL-NEXT:    seta (%rsi) # sched: [3:1.00]
-; HASWELL-NEXT:    sets (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setns (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setp (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setnp (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setl (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setge (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setle (%rsi) # sched: [2:1.00]
-; HASWELL-NEXT:    setg (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    sbbw $511, %di # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [2:0.50]
+; HASWELL-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [9:1.00]
+; HASWELL-NEXT:    sbbw $7, %di # sched: [2:0.50]
+; HASWELL-NEXT:    sbbw $7, (%rsi) # sched: [9:1.00]
+; HASWELL-NEXT:    sbbw %di, %di # sched: [2:0.50]
+; HASWELL-NEXT:    sbbw %di, (%rsi) # sched: [9:1.00]
+; HASWELL-NEXT:    sbbw (%rsi), %di # sched: [7:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_setcc:
+; BROADWELL-LABEL: test_sbb_16:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    seto %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setno %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setb %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setae %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    sete %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setne %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setbe %dil # sched: [2:0.50]
-; BROADWELL-NEXT:    seta %dil # sched: [2:0.50]
-; BROADWELL-NEXT:    sets %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setns %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setp %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setnp %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setl %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setge %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setle %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    setg %dil # sched: [1:0.50]
-; BROADWELL-NEXT:    seto (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setno (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setb (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setae (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    sete (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setne (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setbe (%rsi) # sched: [3:1.00]
-; BROADWELL-NEXT:    seta (%rsi) # sched: [3:1.00]
-; BROADWELL-NEXT:    sets (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setns (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setp (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setnp (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setl (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setge (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setle (%rsi) # sched: [2:1.00]
-; BROADWELL-NEXT:    setg (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    sbbw $511, %di # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbw $7, %di # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbw $7, (%rsi) # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbw %di, %di # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbw %di, (%rsi) # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbw (%rsi), %di # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_setcc:
+; SKYLAKE-LABEL: test_sbb_16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    seto %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setno %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setb %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setae %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    sete %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setne %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setbe %dil # sched: [2:1.00]
-; SKYLAKE-NEXT:    seta %dil # sched: [2:1.00]
-; SKYLAKE-NEXT:    sets %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setns %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setp %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setnp %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setl %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setge %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setle %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    setg %dil # sched: [1:0.50]
-; SKYLAKE-NEXT:    seto (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setno (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setb (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setae (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    sete (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setne (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setbe (%rsi) # sched: [3:1.00]
-; SKYLAKE-NEXT:    seta (%rsi) # sched: [3:1.00]
-; SKYLAKE-NEXT:    sets (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setns (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setp (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setnp (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setl (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setge (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setle (%rsi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    setg (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    sbbw $511, %di # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbw $7, %di # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbw $7, (%rsi) # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbw %di, %di # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbw %di, (%rsi) # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbw (%rsi), %di # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_setcc:
+; SKX-LABEL: test_sbb_16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    seto %dil # sched: [1:0.50]
-; SKX-NEXT:    setno %dil # sched: [1:0.50]
-; SKX-NEXT:    setb %dil # sched: [1:0.50]
-; SKX-NEXT:    setae %dil # sched: [1:0.50]
-; SKX-NEXT:    sete %dil # sched: [1:0.50]
-; SKX-NEXT:    setne %dil # sched: [1:0.50]
-; SKX-NEXT:    setbe %dil # sched: [2:1.00]
-; SKX-NEXT:    seta %dil # sched: [2:1.00]
-; SKX-NEXT:    sets %dil # sched: [1:0.50]
-; SKX-NEXT:    setns %dil # sched: [1:0.50]
-; SKX-NEXT:    setp %dil # sched: [1:0.50]
-; SKX-NEXT:    setnp %dil # sched: [1:0.50]
-; SKX-NEXT:    setl %dil # sched: [1:0.50]
-; SKX-NEXT:    setge %dil # sched: [1:0.50]
-; SKX-NEXT:    setle %dil # sched: [1:0.50]
-; SKX-NEXT:    setg %dil # sched: [1:0.50]
-; SKX-NEXT:    seto (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setno (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setb (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setae (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    sete (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setne (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setbe (%rsi) # sched: [3:1.00]
-; SKX-NEXT:    seta (%rsi) # sched: [3:1.00]
-; SKX-NEXT:    sets (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setns (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setp (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setnp (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setl (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setge (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setle (%rsi) # sched: [2:1.00]
-; SKX-NEXT:    setg (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    sbbw $511, %di # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.50]
+; SKX-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; SKX-NEXT:    # sched: [8:1.00]
+; SKX-NEXT:    sbbw $7, %di # sched: [1:0.50]
+; SKX-NEXT:    sbbw $7, (%rsi) # sched: [8:1.00]
+; SKX-NEXT:    sbbw %di, %di # sched: [1:0.50]
+; SKX-NEXT:    sbbw %di, (%rsi) # sched: [8:1.00]
+; SKX-NEXT:    sbbw (%rsi), %di # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_setcc:
+; BTVER2-LABEL: test_sbb_16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    seto %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setno %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setb %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setae %dil # sched: [1:0.50]
-; BTVER2-NEXT:    sete %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setne %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setbe %dil # sched: [1:0.50]
-; BTVER2-NEXT:    seta %dil # sched: [1:0.50]
-; BTVER2-NEXT:    sets %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setns %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setp %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setnp %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setl %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setge %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setle %dil # sched: [1:0.50]
-; BTVER2-NEXT:    setg %dil # sched: [1:0.50]
-; BTVER2-NEXT:    seto (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setno (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setb (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setae (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    sete (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setne (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setbe (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    seta (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    sets (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setns (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setp (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setnp (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setl (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setge (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setle (%rsi) # sched: [1:1.00]
-; BTVER2-NEXT:    setg (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    sbbw $511, %di # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    sbbw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    sbbw $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    sbbw %di, %di # sched: [1:0.50]
+; BTVER2-NEXT:    sbbw %di, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    sbbw (%rsi), %di # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_setcc:
+; ZNVER1-LABEL: test_sbb_16:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    seto %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setno %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setb %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setae %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    sete %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setne %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setbe %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    seta %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    sets %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setns %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setp %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setnp %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setl %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setge %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setle %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    setg %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    seto (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setno (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setb (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setae (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    sete (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setne (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setbe (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    seta (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    sets (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setns (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setp (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setnp (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setl (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setge (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setle (%rsi) # sched: [1:0.25]
-; ZNVER1-NEXT:    setg (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbw $511, %ax # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbw $511, %di # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbw $511, (%rsi) # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbw $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbw %di, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbw %di, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbw (%rsi), %di # sched: [5:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  tail call void asm "sbbw $2, %AX \0A\09 sbbw $2, $0 \0A\09 sbbw $2, $1 \0A\09 sbbw $3, $0 \0A\09 sbbw $3, $1 \0A\09 sbbw $0, $0 \0A\09 sbbw $0, $1 \0A\09 sbbw $1, $0", "r,*m,i,i"(i16 %a0, i16* %a1, i16 511, i8 7) nounwind
+  ret void
+}
+define void @test_sbb_32(i32 %a0, i32* %a1) optsize {
+; GENERIC-LABEL: test_sbb_32:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [2:0.67]
+; GENERIC-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [9:1.00]
+; GENERIC-NEXT:    sbbl $7, %edi # sched: [2:0.67]
+; GENERIC-NEXT:    sbbl $7, (%rsi) # sched: [9:1.00]
+; GENERIC-NEXT:    sbbl %edi, %edi # sched: [2:0.67]
+; GENERIC-NEXT:    sbbl %edi, (%rsi) # sched: [9:1.00]
+; GENERIC-NEXT:    sbbl (%rsi), %edi # sched: [7:0.67]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_sbb_32:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    sbbl $7, %edi # sched: [1:0.50]
+; ATOM-NEXT:    sbbl $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
+; ATOM-NEXT:    sbbl %edi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    sbbl (%rsi), %edi # sched: [1:1.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_sbb_32:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    sbbl $7, %edi # sched: [1:0.50]
+; SLM-NEXT:    sbbl $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
+; SLM-NEXT:    sbbl %edi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    sbbl (%rsi), %edi # sched: [4:1.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_sbb_32:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [2:0.67]
+; SANDY-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [9:1.00]
+; SANDY-NEXT:    sbbl $7, %edi # sched: [2:0.67]
+; SANDY-NEXT:    sbbl $7, (%rsi) # sched: [9:1.00]
+; SANDY-NEXT:    sbbl %edi, %edi # sched: [2:0.67]
+; SANDY-NEXT:    sbbl %edi, (%rsi) # sched: [9:1.00]
+; SANDY-NEXT:    sbbl (%rsi), %edi # sched: [7:0.67]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_sbb_32:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [2:0.50]
+; HASWELL-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [9:1.00]
+; HASWELL-NEXT:    sbbl $7, %edi # sched: [2:0.50]
+; HASWELL-NEXT:    sbbl $7, (%rsi) # sched: [9:1.00]
+; HASWELL-NEXT:    sbbl %edi, %edi # sched: [2:0.50]
+; HASWELL-NEXT:    sbbl %edi, (%rsi) # sched: [9:1.00]
+; HASWELL-NEXT:    sbbl (%rsi), %edi # sched: [7:0.50]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_sbb_32:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbl $7, %edi # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbl $7, (%rsi) # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbl %edi, (%rsi) # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbl (%rsi), %edi # sched: [6:0.50]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_sbb_32:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbl $7, %edi # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbl $7, (%rsi) # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbl %edi, (%rsi) # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbl (%rsi), %edi # sched: [6:0.50]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_sbb_32:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.50]
+; SKX-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [8:1.00]
+; SKX-NEXT:    sbbl $7, %edi # sched: [1:0.50]
+; SKX-NEXT:    sbbl $7, (%rsi) # sched: [8:1.00]
+; SKX-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
+; SKX-NEXT:    sbbl %edi, (%rsi) # sched: [8:1.00]
+; SKX-NEXT:    sbbl (%rsi), %edi # sched: [6:0.50]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_sbb_32:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    sbbl $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    sbbl $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    sbbl %edi, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    sbbl %edi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    sbbl (%rsi), %edi # sched: [4:1.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_sbb_32:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    sbbl $665536, %eax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbl $665536, %edi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbl $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbl $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbl $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbl %edi, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbl %edi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbl (%rsi), %edi # sched: [5:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  tail call void asm "sbbl $2, %EAX \0A\09 sbbl $2, $0 \0A\09 sbbl $2, $1 \0A\09 sbbl $3, $0 \0A\09 sbbl $3, $1 \0A\09 sbbl $0, $0 \0A\09 sbbl $0, $1 \0A\09 sbbl $1, $0", "r,*m,i,i"(i32 %a0, i32* %a1, i32 665536, i8 7) nounwind
+  ret void
+}
+define void @test_sbb_64(i64 %a0, i64* %a1) optsize {
+; GENERIC-LABEL: test_sbb_64:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [2:0.67]
+; GENERIC-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [9:1.00]
+; GENERIC-NEXT:    sbbq $7, %rdi # sched: [2:0.67]
+; GENERIC-NEXT:    sbbq $7, (%rsi) # sched: [9:1.00]
+; GENERIC-NEXT:    sbbq %rdi, %rdi # sched: [2:0.67]
+; GENERIC-NEXT:    sbbq %rdi, (%rsi) # sched: [9:1.00]
+; GENERIC-NEXT:    sbbq (%rsi), %rdi # sched: [7:0.67]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_sbb_64:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    sbbq $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    sbbq %rdi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    sbbq (%rsi), %rdi # sched: [1:1.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_sbb_64:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
+; SLM-NEXT:    sbbq $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
+; SLM-NEXT:    sbbq %rdi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    sbbq (%rsi), %rdi # sched: [4:1.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_sbb_64:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [2:0.67]
+; SANDY-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [9:1.00]
+; SANDY-NEXT:    sbbq $7, %rdi # sched: [2:0.67]
+; SANDY-NEXT:    sbbq $7, (%rsi) # sched: [9:1.00]
+; SANDY-NEXT:    sbbq %rdi, %rdi # sched: [2:0.67]
+; SANDY-NEXT:    sbbq %rdi, (%rsi) # sched: [9:1.00]
+; SANDY-NEXT:    sbbq (%rsi), %rdi # sched: [7:0.67]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_sbb_64:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [2:0.50]
+; HASWELL-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [9:1.00]
+; HASWELL-NEXT:    sbbq $7, %rdi # sched: [2:0.50]
+; HASWELL-NEXT:    sbbq $7, (%rsi) # sched: [9:1.00]
+; HASWELL-NEXT:    sbbq %rdi, %rdi # sched: [2:0.50]
+; HASWELL-NEXT:    sbbq %rdi, (%rsi) # sched: [9:1.00]
+; HASWELL-NEXT:    sbbq (%rsi), %rdi # sched: [7:0.50]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_sbb_64:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbq $7, (%rsi) # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
+; BROADWELL-NEXT:    sbbq %rdi, (%rsi) # sched: [8:1.00]
+; BROADWELL-NEXT:    sbbq (%rsi), %rdi # sched: [6:0.50]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_sbb_64:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbq $7, (%rsi) # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
+; SKYLAKE-NEXT:    sbbq %rdi, (%rsi) # sched: [8:1.00]
+; SKYLAKE-NEXT:    sbbq (%rsi), %rdi # sched: [6:0.50]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_sbb_64:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.50]
+; SKX-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [8:1.00]
+; SKX-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
+; SKX-NEXT:    sbbq $7, (%rsi) # sched: [8:1.00]
+; SKX-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
+; SKX-NEXT:    sbbq %rdi, (%rsi) # sched: [8:1.00]
+; SKX-NEXT:    sbbq (%rsi), %rdi # sched: [6:0.50]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_sbb_64:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    sbbq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    sbbq $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    sbbq %rdi, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    sbbq %rdi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    sbbq (%rsi), %rdi # sched: [4:1.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_sbb_64:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    sbbq $665536, %rax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbq $665536, %rdi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbq $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbq $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbq %rdi, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    sbbq %rdi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    sbbq (%rsi), %rdi # sched: [5:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  tail call void asm "sbbq $2, %RAX \0A\09 sbbq $2, $0 \0A\09 sbbq $2, $1 \0A\09 sbbq $3, $0 \0A\09 sbbq $3, $1 \0A\09 sbbq $0, $0 \0A\09 sbbq $0, $1 \0A\09 sbbq $1, $0", "r,*m,i,i"(i64 %a0, i64* %a1, i32 665536, i8 7) nounwind
+  ret void
+}
+
+define void @test_scas() optsize {
+; GENERIC-LABEL: test_scas:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    scasb %es:(%rdi), %al # sched: [2:0.67]
+; GENERIC-NEXT:    scasw %es:(%rdi), %ax # sched: [2:0.67]
+; GENERIC-NEXT:    scasl %es:(%rdi), %eax # sched: [2:0.67]
+; GENERIC-NEXT:    scasq %es:(%rdi), %rax # sched: [2:0.67]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_scas:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    scasb %es:(%rdi), %al # sched: [2:1.00]
+; ATOM-NEXT:    scasw %es:(%rdi), %ax # sched: [2:1.00]
+; ATOM-NEXT:    scasl %es:(%rdi), %eax # sched: [2:1.00]
+; ATOM-NEXT:    scasq %es:(%rdi), %rax # sched: [2:1.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_scas:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    scasb %es:(%rdi), %al # sched: [100:1.00]
+; SLM-NEXT:    scasw %es:(%rdi), %ax # sched: [100:1.00]
+; SLM-NEXT:    scasl %es:(%rdi), %eax # sched: [100:1.00]
+; SLM-NEXT:    scasq %es:(%rdi), %rax # sched: [100:1.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_scas:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    scasb %es:(%rdi), %al # sched: [2:0.67]
+; SANDY-NEXT:    scasw %es:(%rdi), %ax # sched: [2:0.67]
+; SANDY-NEXT:    scasl %es:(%rdi), %eax # sched: [2:0.67]
+; SANDY-NEXT:    scasq %es:(%rdi), %rax # sched: [2:0.67]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_scas:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    scasb %es:(%rdi), %al # sched: [7:0.50]
+; HASWELL-NEXT:    scasw %es:(%rdi), %ax # sched: [7:0.50]
+; HASWELL-NEXT:    scasl %es:(%rdi), %eax # sched: [7:0.50]
+; HASWELL-NEXT:    scasq %es:(%rdi), %rax # sched: [7:0.50]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_scas:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    scasb %es:(%rdi), %al # sched: [7:0.50]
+; BROADWELL-NEXT:    scasw %es:(%rdi), %ax # sched: [7:0.50]
+; BROADWELL-NEXT:    scasl %es:(%rdi), %eax # sched: [7:0.50]
+; BROADWELL-NEXT:    scasq %es:(%rdi), %rax # sched: [7:0.50]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_scas:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    scasb %es:(%rdi), %al # sched: [7:0.50]
+; SKYLAKE-NEXT:    scasw %es:(%rdi), %ax # sched: [7:0.50]
+; SKYLAKE-NEXT:    scasl %es:(%rdi), %eax # sched: [7:0.50]
+; SKYLAKE-NEXT:    scasq %es:(%rdi), %rax # sched: [7:0.50]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_scas:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    scasb %es:(%rdi), %al # sched: [7:0.50]
+; SKX-NEXT:    scasw %es:(%rdi), %ax # sched: [7:0.50]
+; SKX-NEXT:    scasl %es:(%rdi), %eax # sched: [7:0.50]
+; SKX-NEXT:    scasq %es:(%rdi), %rax # sched: [7:0.50]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_scas:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    scasb %es:(%rdi), %al # sched: [100:0.17]
+; BTVER2-NEXT:    scasw %es:(%rdi), %ax # sched: [100:0.17]
+; BTVER2-NEXT:    scasl %es:(%rdi), %eax # sched: [100:0.17]
+; BTVER2-NEXT:    scasq %es:(%rdi), %rax # sched: [100:0.17]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_scas:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    scasb %es:(%rdi), %al # sched: [100:?]
+; ZNVER1-NEXT:    scasw %es:(%rdi), %ax # sched: [100:?]
+; ZNVER1-NEXT:    scasl %es:(%rdi), %eax # sched: [100:?]
+; ZNVER1-NEXT:    scasq %es:(%rdi), %rax # sched: [100:?]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  call void asm sideeffect "scasb \0A\09 scasw \0A\09 scasl \0A\09 scasq", ""()
+  ret void
+}
+
+define void @test_setcc(i8 %a0, i8 *%a1) optsize {
+; GENERIC-LABEL: test_setcc:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    seto %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setno %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setb %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setae %dil # sched: [1:0.50]
+; GENERIC-NEXT:    sete %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setne %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setbe %dil # sched: [2:1.00]
+; GENERIC-NEXT:    seta %dil # sched: [2:1.00]
+; GENERIC-NEXT:    sets %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setns %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setp %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setnp %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setl %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setge %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setle %dil # sched: [1:0.50]
+; GENERIC-NEXT:    setg %dil # sched: [1:0.50]
+; GENERIC-NEXT:    seto (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setno (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setb (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setae (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    sete (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setne (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setbe (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    seta (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    sets (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setns (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setp (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setnp (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setl (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setge (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setle (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    setg (%rsi) # sched: [5:1.00]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_setcc:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    seto %dil # sched: [1:0.50]
+; ATOM-NEXT:    setno %dil # sched: [1:0.50]
+; ATOM-NEXT:    setb %dil # sched: [1:0.50]
+; ATOM-NEXT:    setae %dil # sched: [1:0.50]
+; ATOM-NEXT:    sete %dil # sched: [1:0.50]
+; ATOM-NEXT:    setne %dil # sched: [1:0.50]
+; ATOM-NEXT:    setbe %dil # sched: [1:0.50]
+; ATOM-NEXT:    seta %dil # sched: [1:0.50]
+; ATOM-NEXT:    sets %dil # sched: [1:0.50]
+; ATOM-NEXT:    setns %dil # sched: [1:0.50]
+; ATOM-NEXT:    setp %dil # sched: [1:0.50]
+; ATOM-NEXT:    setnp %dil # sched: [1:0.50]
+; ATOM-NEXT:    setl %dil # sched: [1:0.50]
+; ATOM-NEXT:    setge %dil # sched: [1:0.50]
+; ATOM-NEXT:    setle %dil # sched: [1:0.50]
+; ATOM-NEXT:    setg %dil # sched: [1:0.50]
+; ATOM-NEXT:    seto (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setno (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setb (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setae (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    sete (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setne (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setbe (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    seta (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    sets (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setns (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setp (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setnp (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setl (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setge (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setle (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    setg (%rsi) # sched: [2:1.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_setcc:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    seto %dil # sched: [1:0.50]
+; SLM-NEXT:    setno %dil # sched: [1:0.50]
+; SLM-NEXT:    setb %dil # sched: [1:0.50]
+; SLM-NEXT:    setae %dil # sched: [1:0.50]
+; SLM-NEXT:    sete %dil # sched: [1:0.50]
+; SLM-NEXT:    setne %dil # sched: [1:0.50]
+; SLM-NEXT:    setbe %dil # sched: [1:0.50]
+; SLM-NEXT:    seta %dil # sched: [1:0.50]
+; SLM-NEXT:    sets %dil # sched: [1:0.50]
+; SLM-NEXT:    setns %dil # sched: [1:0.50]
+; SLM-NEXT:    setp %dil # sched: [1:0.50]
+; SLM-NEXT:    setnp %dil # sched: [1:0.50]
+; SLM-NEXT:    setl %dil # sched: [1:0.50]
+; SLM-NEXT:    setge %dil # sched: [1:0.50]
+; SLM-NEXT:    setle %dil # sched: [1:0.50]
+; SLM-NEXT:    setg %dil # sched: [1:0.50]
+; SLM-NEXT:    seto (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setno (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setb (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setae (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    sete (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setne (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setbe (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    seta (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    sets (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setns (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setp (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setnp (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setl (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setge (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setle (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    setg (%rsi) # sched: [1:1.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_setcc:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    seto %dil # sched: [1:0.50]
+; SANDY-NEXT:    setno %dil # sched: [1:0.50]
+; SANDY-NEXT:    setb %dil # sched: [1:0.50]
+; SANDY-NEXT:    setae %dil # sched: [1:0.50]
+; SANDY-NEXT:    sete %dil # sched: [1:0.50]
+; SANDY-NEXT:    setne %dil # sched: [1:0.50]
+; SANDY-NEXT:    setbe %dil # sched: [2:1.00]
+; SANDY-NEXT:    seta %dil # sched: [2:1.00]
+; SANDY-NEXT:    sets %dil # sched: [1:0.50]
+; SANDY-NEXT:    setns %dil # sched: [1:0.50]
+; SANDY-NEXT:    setp %dil # sched: [1:0.50]
+; SANDY-NEXT:    setnp %dil # sched: [1:0.50]
+; SANDY-NEXT:    setl %dil # sched: [1:0.50]
+; SANDY-NEXT:    setge %dil # sched: [1:0.50]
+; SANDY-NEXT:    setle %dil # sched: [1:0.50]
+; SANDY-NEXT:    setg %dil # sched: [1:0.50]
+; SANDY-NEXT:    seto (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setno (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setb (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setae (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    sete (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setne (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setbe (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    seta (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    sets (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setns (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setp (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setnp (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setl (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setge (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setle (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    setg (%rsi) # sched: [5:1.00]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_setcc:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    seto %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setno %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setb %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setae %dil # sched: [1:0.50]
+; HASWELL-NEXT:    sete %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setne %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setbe %dil # sched: [2:0.50]
+; HASWELL-NEXT:    seta %dil # sched: [2:0.50]
+; HASWELL-NEXT:    sets %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setns %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setp %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setnp %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setl %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setge %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setle %dil # sched: [1:0.50]
+; HASWELL-NEXT:    setg %dil # sched: [1:0.50]
+; HASWELL-NEXT:    seto (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setno (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setb (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setae (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    sete (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setne (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setbe (%rsi) # sched: [3:1.00]
+; HASWELL-NEXT:    seta (%rsi) # sched: [3:1.00]
+; HASWELL-NEXT:    sets (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setns (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setp (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setnp (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setl (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setge (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setle (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    setg (%rsi) # sched: [2:1.00]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_setcc:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    seto %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setno %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setb %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setae %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    sete %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setne %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setbe %dil # sched: [2:0.50]
+; BROADWELL-NEXT:    seta %dil # sched: [2:0.50]
+; BROADWELL-NEXT:    sets %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setns %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setp %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setnp %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setl %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setge %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setle %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    setg %dil # sched: [1:0.50]
+; BROADWELL-NEXT:    seto (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setno (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setb (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setae (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    sete (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setne (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setbe (%rsi) # sched: [3:1.00]
+; BROADWELL-NEXT:    seta (%rsi) # sched: [3:1.00]
+; BROADWELL-NEXT:    sets (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setns (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setp (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setnp (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setl (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setge (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setle (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    setg (%rsi) # sched: [2:1.00]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_setcc:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    seto %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setno %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setb %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setae %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    sete %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setne %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setbe %dil # sched: [2:1.00]
+; SKYLAKE-NEXT:    seta %dil # sched: [2:1.00]
+; SKYLAKE-NEXT:    sets %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setns %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setp %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setnp %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setl %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setge %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setle %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    setg %dil # sched: [1:0.50]
+; SKYLAKE-NEXT:    seto (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setno (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setb (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setae (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    sete (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setne (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setbe (%rsi) # sched: [3:1.00]
+; SKYLAKE-NEXT:    seta (%rsi) # sched: [3:1.00]
+; SKYLAKE-NEXT:    sets (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setns (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setp (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setnp (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setl (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setge (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setle (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    setg (%rsi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_setcc:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    seto %dil # sched: [1:0.50]
+; SKX-NEXT:    setno %dil # sched: [1:0.50]
+; SKX-NEXT:    setb %dil # sched: [1:0.50]
+; SKX-NEXT:    setae %dil # sched: [1:0.50]
+; SKX-NEXT:    sete %dil # sched: [1:0.50]
+; SKX-NEXT:    setne %dil # sched: [1:0.50]
+; SKX-NEXT:    setbe %dil # sched: [2:1.00]
+; SKX-NEXT:    seta %dil # sched: [2:1.00]
+; SKX-NEXT:    sets %dil # sched: [1:0.50]
+; SKX-NEXT:    setns %dil # sched: [1:0.50]
+; SKX-NEXT:    setp %dil # sched: [1:0.50]
+; SKX-NEXT:    setnp %dil # sched: [1:0.50]
+; SKX-NEXT:    setl %dil # sched: [1:0.50]
+; SKX-NEXT:    setge %dil # sched: [1:0.50]
+; SKX-NEXT:    setle %dil # sched: [1:0.50]
+; SKX-NEXT:    setg %dil # sched: [1:0.50]
+; SKX-NEXT:    seto (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setno (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setb (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setae (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    sete (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setne (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setbe (%rsi) # sched: [3:1.00]
+; SKX-NEXT:    seta (%rsi) # sched: [3:1.00]
+; SKX-NEXT:    sets (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setns (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setp (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setnp (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setl (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setge (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setle (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    setg (%rsi) # sched: [2:1.00]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_setcc:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    seto %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setno %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setb %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setae %dil # sched: [1:0.50]
+; BTVER2-NEXT:    sete %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setne %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setbe %dil # sched: [1:0.50]
+; BTVER2-NEXT:    seta %dil # sched: [1:0.50]
+; BTVER2-NEXT:    sets %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setns %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setp %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setnp %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setl %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setge %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setle %dil # sched: [1:0.50]
+; BTVER2-NEXT:    setg %dil # sched: [1:0.50]
+; BTVER2-NEXT:    seto (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setno (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setb (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setae (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    sete (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setne (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setbe (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    seta (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    sets (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setns (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setp (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setnp (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setl (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setge (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setle (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    setg (%rsi) # sched: [1:1.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_setcc:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    seto %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setno %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setb %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setae %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    sete %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setne %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setbe %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    seta %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    sets %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setns %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setp %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setnp %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setl %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setge %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setle %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    setg %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    seto (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setno (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setb (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setae (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    sete (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setne (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setbe (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    seta (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    sets (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setns (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setp (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setnp (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setl (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setge (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setle (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    setg (%rsi) # sched: [1:0.25]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  call void asm sideeffect "seto $0 \0A\09 setno $0 \0A\09 setb $0 \0A\09 setnb $0 \0A\09 setz $0 \0A\09 setnz $0 \0A\09 setbe $0 \0A\09 setnbe $0 \0A\09 sets $0 \0A\09 setns $0 \0A\09 setp $0 \0A\09 setnp $0 \0A\09 setl $0 \0A\09 setnl $0 \0A\09 setle $0 \0A\09 setnle $0 \0A\09 seto $1 \0A\09 setno $1 \0A\09 setb $1 \0A\09 setnb $1 \0A\09 setz $1 \0A\09 setnz $1 \0A\09 setbe $1 \0A\09 setnbe $1 \0A\09 sets $1 \0A\09 setns $1 \0A\09 setp $1 \0A\09 setnp $1 \0A\09 setl $1 \0A\09 setnl $1 \0A\09 setle $1 \0A\09 setnle $1", "r,*m"(i8 %a0, i8 *%a1)
+  ret void
+}
+
+define void @test_shld_shrd_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
+; GENERIC-LABEL: test_shld_shrd_16:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    shldw %cl, %si, %di # sched: [4:1.50]
+; GENERIC-NEXT:    shrdw %cl, %si, %di # sched: [4:1.50]
+; GENERIC-NEXT:    shldw %cl, %si, (%rdx) # sched: [10:1.50]
+; GENERIC-NEXT:    shrdw %cl, %si, (%rdx) # sched: [10:1.50]
+; GENERIC-NEXT:    shldw $7, %si, %di # sched: [2:0.67]
+; GENERIC-NEXT:    shrdw $7, %si, %di # sched: [2:0.67]
+; GENERIC-NEXT:    shldw $7, %si, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    shrdw $7, %si, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_shld_shrd_16:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    shldw %cl, %si, %di # sched: [6:3.00]
+; ATOM-NEXT:    shrdw %cl, %si, %di # sched: [6:3.00]
+; ATOM-NEXT:    shldw %cl, %si, (%rdx) # sched: [6:3.00]
+; ATOM-NEXT:    shrdw %cl, %si, (%rdx) # sched: [6:3.00]
+; ATOM-NEXT:    shldw $7, %si, %di # sched: [6:3.00]
+; ATOM-NEXT:    shrdw $7, %si, %di # sched: [6:3.00]
+; ATOM-NEXT:    shldw $7, %si, (%rdx) # sched: [6:3.00]
+; ATOM-NEXT:    shrdw $7, %si, (%rdx) # sched: [6:3.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_shld_shrd_16:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    shldw %cl, %si, %di # sched: [1:1.00]
+; SLM-NEXT:    shrdw %cl, %si, %di # sched: [1:1.00]
+; SLM-NEXT:    shldw %cl, %si, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrdw %cl, %si, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shldw $7, %si, %di # sched: [1:1.00]
+; SLM-NEXT:    shrdw $7, %si, %di # sched: [1:1.00]
+; SLM-NEXT:    shldw $7, %si, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrdw $7, %si, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_shld_shrd_16:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    shldw %cl, %si, %di # sched: [4:1.50]
+; SANDY-NEXT:    shrdw %cl, %si, %di # sched: [4:1.50]
+; SANDY-NEXT:    shldw %cl, %si, (%rdx) # sched: [10:1.50]
+; SANDY-NEXT:    shrdw %cl, %si, (%rdx) # sched: [10:1.50]
+; SANDY-NEXT:    shldw $7, %si, %di # sched: [2:0.67]
+; SANDY-NEXT:    shrdw $7, %si, %di # sched: [2:0.67]
+; SANDY-NEXT:    shldw $7, %si, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    shrdw $7, %si, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_shld_shrd_16:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    shldw %cl, %si, %di # sched: [6:1.00]
+; HASWELL-NEXT:    shrdw %cl, %si, %di # sched: [6:1.00]
+; HASWELL-NEXT:    shldw %cl, %si, (%rdx) # sched: [12:1.00]
+; HASWELL-NEXT:    shrdw %cl, %si, (%rdx) # sched: [12:1.00]
+; HASWELL-NEXT:    shldw $7, %si, %di # sched: [3:1.00]
+; HASWELL-NEXT:    shrdw $7, %si, %di # sched: [3:1.00]
+; HASWELL-NEXT:    shldw $7, %si, (%rdx) # sched: [10:1.00]
+; HASWELL-NEXT:    shrdw $7, %si, (%rdx) # sched: [10:1.00]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_shld_shrd_16:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    shldw %cl, %si, %di # sched: [6:1.00]
+; BROADWELL-NEXT:    shrdw %cl, %si, %di # sched: [6:1.00]
+; BROADWELL-NEXT:    shldw %cl, %si, (%rdx) # sched: [11:1.00]
+; BROADWELL-NEXT:    shrdw %cl, %si, (%rdx) # sched: [11:1.00]
+; BROADWELL-NEXT:    shldw $7, %si, %di # sched: [3:1.00]
+; BROADWELL-NEXT:    shrdw $7, %si, %di # sched: [3:1.00]
+; BROADWELL-NEXT:    shldw $7, %si, (%rdx) # sched: [9:1.00]
+; BROADWELL-NEXT:    shrdw $7, %si, (%rdx) # sched: [9:1.00]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_shld_shrd_16:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    shldw %cl, %si, %di # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrdw %cl, %si, %di # sched: [6:1.00]
+; SKYLAKE-NEXT:    shldw %cl, %si, (%rdx) # sched: [11:1.00]
+; SKYLAKE-NEXT:    shrdw %cl, %si, (%rdx) # sched: [11:1.00]
+; SKYLAKE-NEXT:    shldw $7, %si, %di # sched: [3:1.00]
+; SKYLAKE-NEXT:    shrdw $7, %si, %di # sched: [3:1.00]
+; SKYLAKE-NEXT:    shldw $7, %si, (%rdx) # sched: [9:1.00]
+; SKYLAKE-NEXT:    shrdw $7, %si, (%rdx) # sched: [9:1.00]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_shld_shrd_16:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    shldw %cl, %si, %di # sched: [6:1.00]
+; SKX-NEXT:    shrdw %cl, %si, %di # sched: [6:1.00]
+; SKX-NEXT:    shldw %cl, %si, (%rdx) # sched: [11:1.00]
+; SKX-NEXT:    shrdw %cl, %si, (%rdx) # sched: [11:1.00]
+; SKX-NEXT:    shldw $7, %si, %di # sched: [3:1.00]
+; SKX-NEXT:    shrdw $7, %si, %di # sched: [3:1.00]
+; SKX-NEXT:    shldw $7, %si, (%rdx) # sched: [9:1.00]
+; SKX-NEXT:    shrdw $7, %si, (%rdx) # sched: [9:1.00]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_shld_shrd_16:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    shldw %cl, %si, %di # sched: [4:4.00]
+; BTVER2-NEXT:    shrdw %cl, %si, %di # sched: [4:4.00]
+; BTVER2-NEXT:    shldw %cl, %si, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    shrdw %cl, %si, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    shldw $7, %si, %di # sched: [3:3.00]
+; BTVER2-NEXT:    shrdw $7, %si, %di # sched: [3:3.00]
+; BTVER2-NEXT:    shldw $7, %si, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    shrdw $7, %si, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_shld_shrd_16:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    shldw %cl, %si, %di # sched: [100:?]
+; ZNVER1-NEXT:    shrdw %cl, %si, %di # sched: [100:?]
+; ZNVER1-NEXT:    shldw %cl, %si, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    shrdw %cl, %si, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    shldw $7, %si, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    shrdw $7, %si, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    shldw $7, %si, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrdw $7, %si, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  call void asm sideeffect "shld $1, $0 \0A\09 shrd $1, $0 \0A\09 shld $1, $2 \0A\09 shrd $1, $2 \0A\09 shld $3, $1, $0 \0A\09 shrd $3, $1, $0 \0A\09 shld $3, $1, $2 \0A\09 shrd $3, $1, $2", "r,r,*m,i"(i16 %a0, i16 %a1, i16 *%a2, i8 7)
+  ret void
+}
+define void @test_shld_shrd_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
+; GENERIC-LABEL: test_shld_shrd_32:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    shldl %cl, %esi, %edi # sched: [4:1.50]
+; GENERIC-NEXT:    shrdl %cl, %esi, %edi # sched: [4:1.50]
+; GENERIC-NEXT:    shldl %cl, %esi, (%rdx) # sched: [10:1.50]
+; GENERIC-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [10:1.50]
+; GENERIC-NEXT:    shldl $7, %esi, %edi # sched: [2:0.67]
+; GENERIC-NEXT:    shrdl $7, %esi, %edi # sched: [2:0.67]
+; GENERIC-NEXT:    shldl $7, %esi, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    shrdl $7, %esi, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_shld_shrd_32:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    shldl %cl, %esi, %edi # sched: [2:1.00]
+; ATOM-NEXT:    shrdl %cl, %esi, %edi # sched: [2:1.00]
+; ATOM-NEXT:    shldl %cl, %esi, (%rdx) # sched: [4:2.00]
+; ATOM-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [4:2.00]
+; ATOM-NEXT:    shldl $7, %esi, %edi # sched: [2:1.00]
+; ATOM-NEXT:    shrdl $7, %esi, %edi # sched: [2:1.00]
+; ATOM-NEXT:    shldl $7, %esi, (%rdx) # sched: [4:2.00]
+; ATOM-NEXT:    shrdl $7, %esi, (%rdx) # sched: [4:2.00]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_shld_shrd_32:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    shldl %cl, %esi, %edi # sched: [1:1.00]
+; SLM-NEXT:    shrdl %cl, %esi, %edi # sched: [1:1.00]
+; SLM-NEXT:    shldl %cl, %esi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shldl $7, %esi, %edi # sched: [1:1.00]
+; SLM-NEXT:    shrdl $7, %esi, %edi # sched: [1:1.00]
+; SLM-NEXT:    shldl $7, %esi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrdl $7, %esi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_shld_shrd_32:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    shldl %cl, %esi, %edi # sched: [4:1.50]
+; SANDY-NEXT:    shrdl %cl, %esi, %edi # sched: [4:1.50]
+; SANDY-NEXT:    shldl %cl, %esi, (%rdx) # sched: [10:1.50]
+; SANDY-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [10:1.50]
+; SANDY-NEXT:    shldl $7, %esi, %edi # sched: [2:0.67]
+; SANDY-NEXT:    shrdl $7, %esi, %edi # sched: [2:0.67]
+; SANDY-NEXT:    shldl $7, %esi, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    shrdl $7, %esi, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_shld_shrd_32:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    shldl %cl, %esi, %edi # sched: [6:1.00]
+; HASWELL-NEXT:    shrdl %cl, %esi, %edi # sched: [6:1.00]
+; HASWELL-NEXT:    shldl %cl, %esi, (%rdx) # sched: [12:1.00]
+; HASWELL-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [12:1.00]
+; HASWELL-NEXT:    shldl $7, %esi, %edi # sched: [3:1.00]
+; HASWELL-NEXT:    shrdl $7, %esi, %edi # sched: [3:1.00]
+; HASWELL-NEXT:    shldl $7, %esi, (%rdx) # sched: [10:1.00]
+; HASWELL-NEXT:    shrdl $7, %esi, (%rdx) # sched: [10:1.00]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_shld_shrd_32:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    shldl %cl, %esi, %edi # sched: [6:1.00]
+; BROADWELL-NEXT:    shrdl %cl, %esi, %edi # sched: [6:1.00]
+; BROADWELL-NEXT:    shldl %cl, %esi, (%rdx) # sched: [11:1.00]
+; BROADWELL-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [11:1.00]
+; BROADWELL-NEXT:    shldl $7, %esi, %edi # sched: [3:1.00]
+; BROADWELL-NEXT:    shrdl $7, %esi, %edi # sched: [3:1.00]
+; BROADWELL-NEXT:    shldl $7, %esi, (%rdx) # sched: [9:1.00]
+; BROADWELL-NEXT:    shrdl $7, %esi, (%rdx) # sched: [9:1.00]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_shld_shrd_32:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    shldl %cl, %esi, %edi # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrdl %cl, %esi, %edi # sched: [6:1.00]
+; SKYLAKE-NEXT:    shldl %cl, %esi, (%rdx) # sched: [11:1.00]
+; SKYLAKE-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [11:1.00]
+; SKYLAKE-NEXT:    shldl $7, %esi, %edi # sched: [3:1.00]
+; SKYLAKE-NEXT:    shrdl $7, %esi, %edi # sched: [3:1.00]
+; SKYLAKE-NEXT:    shldl $7, %esi, (%rdx) # sched: [9:1.00]
+; SKYLAKE-NEXT:    shrdl $7, %esi, (%rdx) # sched: [9:1.00]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_shld_shrd_32:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    shldl %cl, %esi, %edi # sched: [6:1.00]
+; SKX-NEXT:    shrdl %cl, %esi, %edi # sched: [6:1.00]
+; SKX-NEXT:    shldl %cl, %esi, (%rdx) # sched: [11:1.00]
+; SKX-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [11:1.00]
+; SKX-NEXT:    shldl $7, %esi, %edi # sched: [3:1.00]
+; SKX-NEXT:    shrdl $7, %esi, %edi # sched: [3:1.00]
+; SKX-NEXT:    shldl $7, %esi, (%rdx) # sched: [9:1.00]
+; SKX-NEXT:    shrdl $7, %esi, (%rdx) # sched: [9:1.00]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_shld_shrd_32:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    shldl %cl, %esi, %edi # sched: [4:4.00]
+; BTVER2-NEXT:    shrdl %cl, %esi, %edi # sched: [4:4.00]
+; BTVER2-NEXT:    shldl %cl, %esi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    shldl $7, %esi, %edi # sched: [3:3.00]
+; BTVER2-NEXT:    shrdl $7, %esi, %edi # sched: [3:3.00]
+; BTVER2-NEXT:    shldl $7, %esi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    shrdl $7, %esi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_shld_shrd_32:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    shldl %cl, %esi, %edi # sched: [100:?]
+; ZNVER1-NEXT:    shrdl %cl, %esi, %edi # sched: [100:?]
+; ZNVER1-NEXT:    shldl %cl, %esi, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    shldl $7, %esi, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    shrdl $7, %esi, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    shldl $7, %esi, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrdl $7, %esi, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  call void asm sideeffect "shld $1, $0 \0A\09 shrd $1, $0 \0A\09 shld $1, $2 \0A\09 shrd $1, $2 \0A\09 shld $3, $1, $0 \0A\09 shrd $3, $1, $0 \0A\09 shld $3, $1, $2 \0A\09 shrd $3, $1, $2", "r,r,*m,i"(i32 %a0, i32 %a1, i32 *%a2, i8 7)
+  ret void
+}
+define void @test_shld_shrd_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
+; GENERIC-LABEL: test_shld_shrd_64:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    shldq %cl, %rsi, %rdi # sched: [4:1.50]
+; GENERIC-NEXT:    shrdq %cl, %rsi, %rdi # sched: [4:1.50]
+; GENERIC-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [10:1.50]
+; GENERIC-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [10:1.50]
+; GENERIC-NEXT:    shldq $7, %rsi, %rdi # sched: [2:0.67]
+; GENERIC-NEXT:    shrdq $7, %rsi, %rdi # sched: [2:0.67]
+; GENERIC-NEXT:    shldq $7, %rsi, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_shld_shrd_64:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    shldq %cl, %rsi, %rdi # sched: [8:4.00]
+; ATOM-NEXT:    shrdq %cl, %rsi, %rdi # sched: [8:4.00]
+; ATOM-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [9:4.50]
+; ATOM-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [9:4.50]
+; ATOM-NEXT:    shldq $7, %rsi, %rdi # sched: [9:4.50]
+; ATOM-NEXT:    shrdq $7, %rsi, %rdi # sched: [9:4.50]
+; ATOM-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:4.50]
+; ATOM-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:4.50]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_shld_shrd_64:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    shldq %cl, %rsi, %rdi # sched: [1:1.00]
+; SLM-NEXT:    shrdq %cl, %rsi, %rdi # sched: [1:1.00]
+; SLM-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shldq $7, %rsi, %rdi # sched: [1:1.00]
+; SLM-NEXT:    shrdq $7, %rsi, %rdi # sched: [1:1.00]
+; SLM-NEXT:    shldq $7, %rsi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_shld_shrd_64:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    shldq %cl, %rsi, %rdi # sched: [4:1.50]
+; SANDY-NEXT:    shrdq %cl, %rsi, %rdi # sched: [4:1.50]
+; SANDY-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [10:1.50]
+; SANDY-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [10:1.50]
+; SANDY-NEXT:    shldq $7, %rsi, %rdi # sched: [2:0.67]
+; SANDY-NEXT:    shrdq $7, %rsi, %rdi # sched: [2:0.67]
+; SANDY-NEXT:    shldq $7, %rsi, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_shld_shrd_64:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    shldq %cl, %rsi, %rdi # sched: [6:1.00]
+; HASWELL-NEXT:    shrdq %cl, %rsi, %rdi # sched: [6:1.00]
+; HASWELL-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [12:1.00]
+; HASWELL-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [12:1.00]
+; HASWELL-NEXT:    shldq $7, %rsi, %rdi # sched: [3:1.00]
+; HASWELL-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:1.00]
+; HASWELL-NEXT:    shldq $7, %rsi, (%rdx) # sched: [10:1.00]
+; HASWELL-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [10:1.00]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_shld_shrd_64:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    shldq %cl, %rsi, %rdi # sched: [6:1.00]
+; BROADWELL-NEXT:    shrdq %cl, %rsi, %rdi # sched: [6:1.00]
+; BROADWELL-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [11:1.00]
+; BROADWELL-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [11:1.00]
+; BROADWELL-NEXT:    shldq $7, %rsi, %rdi # sched: [3:1.00]
+; BROADWELL-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:1.00]
+; BROADWELL-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:1.00]
+; BROADWELL-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:1.00]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_shld_shrd_64:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    shldq %cl, %rsi, %rdi # sched: [6:1.00]
+; SKYLAKE-NEXT:    shrdq %cl, %rsi, %rdi # sched: [6:1.00]
+; SKYLAKE-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [11:1.00]
+; SKYLAKE-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [11:1.00]
+; SKYLAKE-NEXT:    shldq $7, %rsi, %rdi # sched: [3:1.00]
+; SKYLAKE-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:1.00]
+; SKYLAKE-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:1.00]
+; SKYLAKE-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:1.00]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_shld_shrd_64:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    shldq %cl, %rsi, %rdi # sched: [6:1.00]
+; SKX-NEXT:    shrdq %cl, %rsi, %rdi # sched: [6:1.00]
+; SKX-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [11:1.00]
+; SKX-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [11:1.00]
+; SKX-NEXT:    shldq $7, %rsi, %rdi # sched: [3:1.00]
+; SKX-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:1.00]
+; SKX-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:1.00]
+; SKX-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:1.00]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_shld_shrd_64:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    shldq %cl, %rsi, %rdi # sched: [4:4.00]
+; BTVER2-NEXT:    shrdq %cl, %rsi, %rdi # sched: [4:4.00]
+; BTVER2-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    shldq $7, %rsi, %rdi # sched: [3:3.00]
+; BTVER2-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:3.00]
+; BTVER2-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_shld_shrd_64:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    shldq %cl, %rsi, %rdi # sched: [100:?]
+; ZNVER1-NEXT:    shrdq %cl, %rsi, %rdi # sched: [100:?]
+; ZNVER1-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    shldq $7, %rsi, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    shrdq $7, %rsi, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    shldq $7, %rsi, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    #NO_APP
+; ZNVER1-NEXT:    retq # sched: [1:0.50]
+  call void asm sideeffect "shld $1, $0 \0A\09 shrd $1, $0 \0A\09 shld $1, $2 \0A\09 shrd $1, $2 \0A\09 shld $3, $1, $0 \0A\09 shrd $3, $1, $0 \0A\09 shld $3, $1, $2 \0A\09 shrd $3, $1, $2", "r,r,*m,i"(i64 %a0, i64 %a1, i64 *%a2, i8 7)
+  ret void
+}
+
+define void @test_stc_std() optsize {
+; GENERIC-LABEL: test_stc_std:
+; GENERIC:       # %bb.0:
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    stc # sched: [1:0.33]
+; GENERIC-NEXT:    std # sched: [1:0.33]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_stc_std:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    stc # sched: [1:0.50]
+; ATOM-NEXT:    std # sched: [21:10.50]
+; ATOM-NEXT:    #NO_APP
+; ATOM-NEXT:    retq # sched: [79:39.50]
+;
+; SLM-LABEL: test_stc_std:
+; SLM:       # %bb.0:
+; SLM-NEXT:    #APP
+; SLM-NEXT:    stc # sched: [1:0.50]
+; SLM-NEXT:    std # sched: [1:0.50]
+; SLM-NEXT:    #NO_APP
+; SLM-NEXT:    retq # sched: [4:1.00]
+;
+; SANDY-LABEL: test_stc_std:
+; SANDY:       # %bb.0:
+; SANDY-NEXT:    #APP
+; SANDY-NEXT:    stc # sched: [1:0.33]
+; SANDY-NEXT:    std # sched: [1:0.33]
+; SANDY-NEXT:    #NO_APP
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_stc_std:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    stc # sched: [1:0.25]
+; HASWELL-NEXT:    std # sched: [6:1.50]
+; HASWELL-NEXT:    #NO_APP
+; HASWELL-NEXT:    retq # sched: [7:1.00]
+;
+; BROADWELL-LABEL: test_stc_std:
+; BROADWELL:       # %bb.0:
+; BROADWELL-NEXT:    #APP
+; BROADWELL-NEXT:    stc # sched: [1:0.25]
+; BROADWELL-NEXT:    std # sched: [6:1.50]
+; BROADWELL-NEXT:    #NO_APP
+; BROADWELL-NEXT:    retq # sched: [7:1.00]
+;
+; SKYLAKE-LABEL: test_stc_std:
+; SKYLAKE:       # %bb.0:
+; SKYLAKE-NEXT:    #APP
+; SKYLAKE-NEXT:    stc # sched: [1:0.25]
+; SKYLAKE-NEXT:    std # sched: [6:1.50]
+; SKYLAKE-NEXT:    #NO_APP
+; SKYLAKE-NEXT:    retq # sched: [7:1.00]
+;
+; SKX-LABEL: test_stc_std:
+; SKX:       # %bb.0:
+; SKX-NEXT:    #APP
+; SKX-NEXT:    stc # sched: [1:0.25]
+; SKX-NEXT:    std # sched: [6:1.50]
+; SKX-NEXT:    #NO_APP
+; SKX-NEXT:    retq # sched: [7:1.00]
+;
+; BTVER2-LABEL: test_stc_std:
+; BTVER2:       # %bb.0:
+; BTVER2-NEXT:    #APP
+; BTVER2-NEXT:    stc # sched: [1:0.50]
+; BTVER2-NEXT:    std # sched: [1:0.50]
+; BTVER2-NEXT:    #NO_APP
+; BTVER2-NEXT:    retq # sched: [4:1.00]
+;
+; ZNVER1-LABEL: test_stc_std:
+; ZNVER1:       # %bb.0:
+; ZNVER1-NEXT:    #APP
+; ZNVER1-NEXT:    stc # sched: [1:0.25]
+; ZNVER1-NEXT:    std # sched: [1:0.25]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "seto $0 \0A\09 setno $0 \0A\09 setb $0 \0A\09 setnb $0 \0A\09 setz $0 \0A\09 setnz $0 \0A\09 setbe $0 \0A\09 setnbe $0 \0A\09 sets $0 \0A\09 setns $0 \0A\09 setp $0 \0A\09 setnp $0 \0A\09 setl $0 \0A\09 setnl $0 \0A\09 setle $0 \0A\09 setnle $0 \0A\09 seto $1 \0A\09 setno $1 \0A\09 setb $1 \0A\09 setnb $1 \0A\09 setz $1 \0A\09 setnz $1 \0A\09 setbe $1 \0A\09 setnbe $1 \0A\09 sets $1 \0A\09 setns $1 \0A\09 setp $1 \0A\09 setnp $1 \0A\09 setl $1 \0A\09 setnl $1 \0A\09 setle $1 \0A\09 setnle $1", "r,*m"(i8 %a0, i8 *%a1)
+  call void asm sideeffect "stc \0A\09 std", ""()
   ret void
 }
 
-define void @test_shld_shrd_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
-; GENERIC-LABEL: test_shld_shrd_16:
+define void @test_stos() optsize {
+; GENERIC-LABEL: test_stos:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    shldw %cl, %si, %di # sched: [4:1.50]
-; GENERIC-NEXT:    shrdw %cl, %si, %di # sched: [4:1.50]
-; GENERIC-NEXT:    shldw %cl, %si, (%rdx) # sched: [10:1.50]
-; GENERIC-NEXT:    shrdw %cl, %si, (%rdx) # sched: [10:1.50]
-; GENERIC-NEXT:    shldw $7, %si, %di # sched: [2:0.67]
-; GENERIC-NEXT:    shrdw $7, %si, %di # sched: [2:0.67]
-; GENERIC-NEXT:    shldw $7, %si, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    shrdw $7, %si, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    stosb %al, %es:(%rdi) # sched: [5:1.00]
+; GENERIC-NEXT:    stosw %ax, %es:(%rdi) # sched: [5:1.00]
+; GENERIC-NEXT:    stosl %eax, %es:(%rdi) # sched: [5:1.00]
+; GENERIC-NEXT:    stosq %rax, %es:(%rdi) # sched: [5:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_shld_shrd_16:
+; ATOM-LABEL: test_stos:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    shldw %cl, %si, %di # sched: [6:3.00]
-; ATOM-NEXT:    shrdw %cl, %si, %di # sched: [6:3.00]
-; ATOM-NEXT:    shldw %cl, %si, (%rdx) # sched: [6:3.00]
-; ATOM-NEXT:    shrdw %cl, %si, (%rdx) # sched: [6:3.00]
-; ATOM-NEXT:    shldw $7, %si, %di # sched: [6:3.00]
-; ATOM-NEXT:    shrdw $7, %si, %di # sched: [6:3.00]
-; ATOM-NEXT:    shldw $7, %si, (%rdx) # sched: [6:3.00]
-; ATOM-NEXT:    shrdw $7, %si, (%rdx) # sched: [6:3.00]
+; ATOM-NEXT:    stosb %al, %es:(%rdi) # sched: [1:0.50]
+; ATOM-NEXT:    stosw %ax, %es:(%rdi) # sched: [1:0.50]
+; ATOM-NEXT:    stosl %eax, %es:(%rdi) # sched: [1:0.50]
+; ATOM-NEXT:    stosq %rax, %es:(%rdi) # sched: [1:0.50]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_shld_shrd_16:
+; SLM-LABEL: test_stos:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    shldw %cl, %si, %di # sched: [1:1.00]
-; SLM-NEXT:    shrdw %cl, %si, %di # sched: [1:1.00]
-; SLM-NEXT:    shldw %cl, %si, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrdw %cl, %si, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shldw $7, %si, %di # sched: [1:1.00]
-; SLM-NEXT:    shrdw $7, %si, %di # sched: [1:1.00]
-; SLM-NEXT:    shldw $7, %si, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrdw $7, %si, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    stosb %al, %es:(%rdi) # sched: [100:1.00]
+; SLM-NEXT:    stosw %ax, %es:(%rdi) # sched: [100:1.00]
+; SLM-NEXT:    stosl %eax, %es:(%rdi) # sched: [100:1.00]
+; SLM-NEXT:    stosq %rax, %es:(%rdi) # sched: [100:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_shld_shrd_16:
+; SANDY-LABEL: test_stos:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    shldw %cl, %si, %di # sched: [4:1.50]
-; SANDY-NEXT:    shrdw %cl, %si, %di # sched: [4:1.50]
-; SANDY-NEXT:    shldw %cl, %si, (%rdx) # sched: [10:1.50]
-; SANDY-NEXT:    shrdw %cl, %si, (%rdx) # sched: [10:1.50]
-; SANDY-NEXT:    shldw $7, %si, %di # sched: [2:0.67]
-; SANDY-NEXT:    shrdw $7, %si, %di # sched: [2:0.67]
-; SANDY-NEXT:    shldw $7, %si, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    shrdw $7, %si, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    stosb %al, %es:(%rdi) # sched: [5:1.00]
+; SANDY-NEXT:    stosw %ax, %es:(%rdi) # sched: [5:1.00]
+; SANDY-NEXT:    stosl %eax, %es:(%rdi) # sched: [5:1.00]
+; SANDY-NEXT:    stosq %rax, %es:(%rdi) # sched: [5:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_shld_shrd_16:
+; HASWELL-LABEL: test_stos:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    shldw %cl, %si, %di # sched: [6:1.00]
-; HASWELL-NEXT:    shrdw %cl, %si, %di # sched: [6:1.00]
-; HASWELL-NEXT:    shldw %cl, %si, (%rdx) # sched: [12:1.00]
-; HASWELL-NEXT:    shrdw %cl, %si, (%rdx) # sched: [12:1.00]
-; HASWELL-NEXT:    shldw $7, %si, %di # sched: [3:1.00]
-; HASWELL-NEXT:    shrdw $7, %si, %di # sched: [3:1.00]
-; HASWELL-NEXT:    shldw $7, %si, (%rdx) # sched: [10:1.00]
-; HASWELL-NEXT:    shrdw $7, %si, (%rdx) # sched: [10:1.00]
+; HASWELL-NEXT:    stosb %al, %es:(%rdi) # sched: [2:1.00]
+; HASWELL-NEXT:    stosw %ax, %es:(%rdi) # sched: [2:1.00]
+; HASWELL-NEXT:    stosl %eax, %es:(%rdi) # sched: [2:1.00]
+; HASWELL-NEXT:    stosq %rax, %es:(%rdi) # sched: [2:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_shld_shrd_16:
+; BROADWELL-LABEL: test_stos:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    shldw %cl, %si, %di # sched: [6:1.00]
-; BROADWELL-NEXT:    shrdw %cl, %si, %di # sched: [6:1.00]
-; BROADWELL-NEXT:    shldw %cl, %si, (%rdx) # sched: [11:1.00]
-; BROADWELL-NEXT:    shrdw %cl, %si, (%rdx) # sched: [11:1.00]
-; BROADWELL-NEXT:    shldw $7, %si, %di # sched: [3:1.00]
-; BROADWELL-NEXT:    shrdw $7, %si, %di # sched: [3:1.00]
-; BROADWELL-NEXT:    shldw $7, %si, (%rdx) # sched: [9:1.00]
-; BROADWELL-NEXT:    shrdw $7, %si, (%rdx) # sched: [9:1.00]
+; BROADWELL-NEXT:    stosb %al, %es:(%rdi) # sched: [2:1.00]
+; BROADWELL-NEXT:    stosw %ax, %es:(%rdi) # sched: [2:1.00]
+; BROADWELL-NEXT:    stosl %eax, %es:(%rdi) # sched: [2:1.00]
+; BROADWELL-NEXT:    stosq %rax, %es:(%rdi) # sched: [2:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_shld_shrd_16:
+; SKYLAKE-LABEL: test_stos:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    shldw %cl, %si, %di # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrdw %cl, %si, %di # sched: [6:1.00]
-; SKYLAKE-NEXT:    shldw %cl, %si, (%rdx) # sched: [11:1.00]
-; SKYLAKE-NEXT:    shrdw %cl, %si, (%rdx) # sched: [11:1.00]
-; SKYLAKE-NEXT:    shldw $7, %si, %di # sched: [3:1.00]
-; SKYLAKE-NEXT:    shrdw $7, %si, %di # sched: [3:1.00]
-; SKYLAKE-NEXT:    shldw $7, %si, (%rdx) # sched: [9:1.00]
-; SKYLAKE-NEXT:    shrdw $7, %si, (%rdx) # sched: [9:1.00]
+; SKYLAKE-NEXT:    stosb %al, %es:(%rdi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    stosw %ax, %es:(%rdi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    stosl %eax, %es:(%rdi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    stosq %rax, %es:(%rdi) # sched: [2:1.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_shld_shrd_16:
+; SKX-LABEL: test_stos:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    shldw %cl, %si, %di # sched: [6:1.00]
-; SKX-NEXT:    shrdw %cl, %si, %di # sched: [6:1.00]
-; SKX-NEXT:    shldw %cl, %si, (%rdx) # sched: [11:1.00]
-; SKX-NEXT:    shrdw %cl, %si, (%rdx) # sched: [11:1.00]
-; SKX-NEXT:    shldw $7, %si, %di # sched: [3:1.00]
-; SKX-NEXT:    shrdw $7, %si, %di # sched: [3:1.00]
-; SKX-NEXT:    shldw $7, %si, (%rdx) # sched: [9:1.00]
-; SKX-NEXT:    shrdw $7, %si, (%rdx) # sched: [9:1.00]
+; SKX-NEXT:    stosb %al, %es:(%rdi) # sched: [2:1.00]
+; SKX-NEXT:    stosw %ax, %es:(%rdi) # sched: [2:1.00]
+; SKX-NEXT:    stosl %eax, %es:(%rdi) # sched: [2:1.00]
+; SKX-NEXT:    stosq %rax, %es:(%rdi) # sched: [2:1.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_shld_shrd_16:
+; BTVER2-LABEL: test_stos:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    shldw %cl, %si, %di # sched: [4:4.00]
-; BTVER2-NEXT:    shrdw %cl, %si, %di # sched: [4:4.00]
-; BTVER2-NEXT:    shldw %cl, %si, (%rdx) # sched: [9:11.00]
-; BTVER2-NEXT:    shrdw %cl, %si, (%rdx) # sched: [9:11.00]
-; BTVER2-NEXT:    shldw $7, %si, %di # sched: [3:3.00]
-; BTVER2-NEXT:    shrdw $7, %si, %di # sched: [3:3.00]
-; BTVER2-NEXT:    shldw $7, %si, (%rdx) # sched: [9:11.00]
-; BTVER2-NEXT:    shrdw $7, %si, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    stosb %al, %es:(%rdi) # sched: [100:0.17]
+; BTVER2-NEXT:    stosw %ax, %es:(%rdi) # sched: [100:0.17]
+; BTVER2-NEXT:    stosl %eax, %es:(%rdi) # sched: [100:0.17]
+; BTVER2-NEXT:    stosq %rax, %es:(%rdi) # sched: [100:0.17]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_shld_shrd_16:
+; ZNVER1-LABEL: test_stos:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    shldw %cl, %si, %di # sched: [100:?]
-; ZNVER1-NEXT:    shrdw %cl, %si, %di # sched: [100:?]
-; ZNVER1-NEXT:    shldw %cl, %si, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    shrdw %cl, %si, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    shldw $7, %si, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    shrdw $7, %si, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    shldw $7, %si, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrdw $7, %si, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    stosb %al, %es:(%rdi) # sched: [100:?]
+; ZNVER1-NEXT:    stosw %ax, %es:(%rdi) # sched: [100:?]
+; ZNVER1-NEXT:    stosl %eax, %es:(%rdi) # sched: [100:?]
+; ZNVER1-NEXT:    stosq %rax, %es:(%rdi) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "shld $1, $0 \0A\09 shrd $1, $0 \0A\09 shld $1, $2 \0A\09 shrd $1, $2 \0A\09 shld $3, $1, $0 \0A\09 shrd $3, $1, $0 \0A\09 shld $3, $1, $2 \0A\09 shrd $3, $1, $2", "r,r,*m,i"(i16 %a0, i16 %a1, i16 *%a2, i8 7)
+  call void asm sideeffect "stosb \0A\09 stosw \0A\09 stosl \0A\09 stosq", ""()
   ret void
 }
-define void @test_shld_shrd_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
-; GENERIC-LABEL: test_shld_shrd_32:
+
+define void @test_sub_8(i8 %a0, i8* %a1) optsize {
+; GENERIC-LABEL: test_sub_8:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    shldl %cl, %esi, %edi # sched: [4:1.50]
-; GENERIC-NEXT:    shrdl %cl, %esi, %edi # sched: [4:1.50]
-; GENERIC-NEXT:    shldl %cl, %esi, (%rdx) # sched: [10:1.50]
-; GENERIC-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [10:1.50]
-; GENERIC-NEXT:    shldl $7, %esi, %edi # sched: [2:0.67]
-; GENERIC-NEXT:    shrdl $7, %esi, %edi # sched: [2:0.67]
-; GENERIC-NEXT:    shldl $7, %esi, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    shrdl $7, %esi, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    subb $7, %al # sched: [1:0.33]
+; GENERIC-NEXT:    subb $7, %dil # sched: [1:0.33]
+; GENERIC-NEXT:    subb $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    subb %dil, %dil # sched: [1:0.33]
+; GENERIC-NEXT:    subb %dil, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_shld_shrd_32:
+; ATOM-LABEL: test_sub_8:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    shldl %cl, %esi, %edi # sched: [2:1.00]
-; ATOM-NEXT:    shrdl %cl, %esi, %edi # sched: [2:1.00]
-; ATOM-NEXT:    shldl %cl, %esi, (%rdx) # sched: [4:2.00]
-; ATOM-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [4:2.00]
-; ATOM-NEXT:    shldl $7, %esi, %edi # sched: [2:1.00]
-; ATOM-NEXT:    shrdl $7, %esi, %edi # sched: [2:1.00]
-; ATOM-NEXT:    shldl $7, %esi, (%rdx) # sched: [4:2.00]
-; ATOM-NEXT:    shrdl $7, %esi, (%rdx) # sched: [4:2.00]
+; ATOM-NEXT:    subb $7, %al # sched: [1:0.50]
+; ATOM-NEXT:    subb $7, %dil # sched: [1:0.50]
+; ATOM-NEXT:    subb $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    subb %dil, %dil # sched: [1:0.50]
+; ATOM-NEXT:    subb %dil, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    subb (%rsi), %dil # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_shld_shrd_32:
+; SLM-LABEL: test_sub_8:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    shldl %cl, %esi, %edi # sched: [1:1.00]
-; SLM-NEXT:    shrdl %cl, %esi, %edi # sched: [1:1.00]
-; SLM-NEXT:    shldl %cl, %esi, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shldl $7, %esi, %edi # sched: [1:1.00]
-; SLM-NEXT:    shrdl $7, %esi, %edi # sched: [1:1.00]
-; SLM-NEXT:    shldl $7, %esi, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrdl $7, %esi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    subb $7, %al # sched: [1:0.50]
+; SLM-NEXT:    subb $7, %dil # sched: [1:0.50]
+; SLM-NEXT:    subb $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    subb %dil, %dil # sched: [1:0.50]
+; SLM-NEXT:    subb %dil, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    subb (%rsi), %dil # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_shld_shrd_32:
+; SANDY-LABEL: test_sub_8:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    shldl %cl, %esi, %edi # sched: [4:1.50]
-; SANDY-NEXT:    shrdl %cl, %esi, %edi # sched: [4:1.50]
-; SANDY-NEXT:    shldl %cl, %esi, (%rdx) # sched: [10:1.50]
-; SANDY-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [10:1.50]
-; SANDY-NEXT:    shldl $7, %esi, %edi # sched: [2:0.67]
-; SANDY-NEXT:    shrdl $7, %esi, %edi # sched: [2:0.67]
-; SANDY-NEXT:    shldl $7, %esi, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    shrdl $7, %esi, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    subb $7, %al # sched: [1:0.33]
+; SANDY-NEXT:    subb $7, %dil # sched: [1:0.33]
+; SANDY-NEXT:    subb $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    subb %dil, %dil # sched: [1:0.33]
+; SANDY-NEXT:    subb %dil, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
-; SANDY-NEXT:    retq # sched: [1:1.00]
-;
-; HASWELL-LABEL: test_shld_shrd_32:
-; HASWELL:       # %bb.0:
-; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    shldl %cl, %esi, %edi # sched: [6:1.00]
-; HASWELL-NEXT:    shrdl %cl, %esi, %edi # sched: [6:1.00]
-; HASWELL-NEXT:    shldl %cl, %esi, (%rdx) # sched: [12:1.00]
-; HASWELL-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [12:1.00]
-; HASWELL-NEXT:    shldl $7, %esi, %edi # sched: [3:1.00]
-; HASWELL-NEXT:    shrdl $7, %esi, %edi # sched: [3:1.00]
-; HASWELL-NEXT:    shldl $7, %esi, (%rdx) # sched: [10:1.00]
-; HASWELL-NEXT:    shrdl $7, %esi, (%rdx) # sched: [10:1.00]
+; SANDY-NEXT:    retq # sched: [1:1.00]
+;
+; HASWELL-LABEL: test_sub_8:
+; HASWELL:       # %bb.0:
+; HASWELL-NEXT:    #APP
+; HASWELL-NEXT:    subb $7, %al # sched: [1:0.25]
+; HASWELL-NEXT:    subb $7, %dil # sched: [1:0.25]
+; HASWELL-NEXT:    subb $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    subb %dil, %dil # sched: [1:0.25]
+; HASWELL-NEXT:    subb %dil, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_shld_shrd_32:
+; BROADWELL-LABEL: test_sub_8:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    shldl %cl, %esi, %edi # sched: [6:1.00]
-; BROADWELL-NEXT:    shrdl %cl, %esi, %edi # sched: [6:1.00]
-; BROADWELL-NEXT:    shldl %cl, %esi, (%rdx) # sched: [11:1.00]
-; BROADWELL-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [11:1.00]
-; BROADWELL-NEXT:    shldl $7, %esi, %edi # sched: [3:1.00]
-; BROADWELL-NEXT:    shrdl $7, %esi, %edi # sched: [3:1.00]
-; BROADWELL-NEXT:    shldl $7, %esi, (%rdx) # sched: [9:1.00]
-; BROADWELL-NEXT:    shrdl $7, %esi, (%rdx) # sched: [9:1.00]
+; BROADWELL-NEXT:    subb $7, %al # sched: [1:0.25]
+; BROADWELL-NEXT:    subb $7, %dil # sched: [1:0.25]
+; BROADWELL-NEXT:    subb $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    subb %dil, %dil # sched: [1:0.25]
+; BROADWELL-NEXT:    subb %dil, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_shld_shrd_32:
+; SKYLAKE-LABEL: test_sub_8:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    shldl %cl, %esi, %edi # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrdl %cl, %esi, %edi # sched: [6:1.00]
-; SKYLAKE-NEXT:    shldl %cl, %esi, (%rdx) # sched: [11:1.00]
-; SKYLAKE-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [11:1.00]
-; SKYLAKE-NEXT:    shldl $7, %esi, %edi # sched: [3:1.00]
-; SKYLAKE-NEXT:    shrdl $7, %esi, %edi # sched: [3:1.00]
-; SKYLAKE-NEXT:    shldl $7, %esi, (%rdx) # sched: [9:1.00]
-; SKYLAKE-NEXT:    shrdl $7, %esi, (%rdx) # sched: [9:1.00]
+; SKYLAKE-NEXT:    subb $7, %al # sched: [1:0.25]
+; SKYLAKE-NEXT:    subb $7, %dil # sched: [1:0.25]
+; SKYLAKE-NEXT:    subb $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    subb %dil, %dil # sched: [1:0.25]
+; SKYLAKE-NEXT:    subb %dil, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_shld_shrd_32:
+; SKX-LABEL: test_sub_8:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    shldl %cl, %esi, %edi # sched: [6:1.00]
-; SKX-NEXT:    shrdl %cl, %esi, %edi # sched: [6:1.00]
-; SKX-NEXT:    shldl %cl, %esi, (%rdx) # sched: [11:1.00]
-; SKX-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [11:1.00]
-; SKX-NEXT:    shldl $7, %esi, %edi # sched: [3:1.00]
-; SKX-NEXT:    shrdl $7, %esi, %edi # sched: [3:1.00]
-; SKX-NEXT:    shldl $7, %esi, (%rdx) # sched: [9:1.00]
-; SKX-NEXT:    shrdl $7, %esi, (%rdx) # sched: [9:1.00]
+; SKX-NEXT:    subb $7, %al # sched: [1:0.25]
+; SKX-NEXT:    subb $7, %dil # sched: [1:0.25]
+; SKX-NEXT:    subb $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    subb %dil, %dil # sched: [1:0.25]
+; SKX-NEXT:    subb %dil, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_shld_shrd_32:
+; BTVER2-LABEL: test_sub_8:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    shldl %cl, %esi, %edi # sched: [4:4.00]
-; BTVER2-NEXT:    shrdl %cl, %esi, %edi # sched: [4:4.00]
-; BTVER2-NEXT:    shldl %cl, %esi, (%rdx) # sched: [9:11.00]
-; BTVER2-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [9:11.00]
-; BTVER2-NEXT:    shldl $7, %esi, %edi # sched: [3:3.00]
-; BTVER2-NEXT:    shrdl $7, %esi, %edi # sched: [3:3.00]
-; BTVER2-NEXT:    shldl $7, %esi, (%rdx) # sched: [9:11.00]
-; BTVER2-NEXT:    shrdl $7, %esi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    subb $7, %al # sched: [1:0.50]
+; BTVER2-NEXT:    subb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    subb $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    subb %dil, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    subb %dil, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    subb (%rsi), %dil # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_shld_shrd_32:
+; ZNVER1-LABEL: test_sub_8:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    shldl %cl, %esi, %edi # sched: [100:?]
-; ZNVER1-NEXT:    shrdl %cl, %esi, %edi # sched: [100:?]
-; ZNVER1-NEXT:    shldl %cl, %esi, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    shrdl %cl, %esi, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    shldl $7, %esi, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    shrdl $7, %esi, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    shldl $7, %esi, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrdl $7, %esi, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    subb $7, %al # sched: [1:0.25]
+; ZNVER1-NEXT:    subb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    subb $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    subb %dil, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    subb %dil, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    subb (%rsi), %dil # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "shld $1, $0 \0A\09 shrd $1, $0 \0A\09 shld $1, $2 \0A\09 shrd $1, $2 \0A\09 shld $3, $1, $0 \0A\09 shrd $3, $1, $0 \0A\09 shld $3, $1, $2 \0A\09 shrd $3, $1, $2", "r,r,*m,i"(i32 %a0, i32 %a1, i32 *%a2, i8 7)
+  tail call void asm "subb $2, %AL \0A\09 subb $2, $0 \0A\09 subb $2, $1 \0A\09 subb $0, $0 \0A\09 subb $0, $1 \0A\09 subb $1, $0", "r,*m,i"(i8 %a0, i8* %a1, i8 7) nounwind
   ret void
 }
-define void @test_shld_shrd_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
-; GENERIC-LABEL: test_shld_shrd_64:
+define void @test_sub_16(i16 %a0, i16* %a1) optsize {
+; GENERIC-LABEL: test_sub_16:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    shldq %cl, %rsi, %rdi # sched: [4:1.50]
-; GENERIC-NEXT:    shrdq %cl, %rsi, %rdi # sched: [4:1.50]
-; GENERIC-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [10:1.50]
-; GENERIC-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [10:1.50]
-; GENERIC-NEXT:    shldq $7, %rsi, %rdi # sched: [2:0.67]
-; GENERIC-NEXT:    shrdq $7, %rsi, %rdi # sched: [2:0.67]
-; GENERIC-NEXT:    shldq $7, %rsi, (%rdx) # sched: [8:1.00]
-; GENERIC-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    subw $511, %ax # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    subw $511, %di # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    subw $7, %di # sched: [1:0.33]
+; GENERIC-NEXT:    subw $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    subw %di, %di # sched: [1:0.33]
+; GENERIC-NEXT:    subw %di, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    subw (%rsi), %di # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_shld_shrd_64:
+; ATOM-LABEL: test_sub_16:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    shldq %cl, %rsi, %rdi # sched: [8:4.00]
-; ATOM-NEXT:    shrdq %cl, %rsi, %rdi # sched: [8:4.00]
-; ATOM-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [9:4.50]
-; ATOM-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [9:4.50]
-; ATOM-NEXT:    shldq $7, %rsi, %rdi # sched: [9:4.50]
-; ATOM-NEXT:    shrdq $7, %rsi, %rdi # sched: [9:4.50]
-; ATOM-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:4.50]
-; ATOM-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:4.50]
+; ATOM-NEXT:    subw $511, %ax # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    subw $511, %di # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    subw $7, %di # sched: [1:0.50]
+; ATOM-NEXT:    subw $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    subw %di, %di # sched: [1:0.50]
+; ATOM-NEXT:    subw %di, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    subw (%rsi), %di # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_shld_shrd_64:
+; SLM-LABEL: test_sub_16:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    shldq %cl, %rsi, %rdi # sched: [1:1.00]
-; SLM-NEXT:    shrdq %cl, %rsi, %rdi # sched: [1:1.00]
-; SLM-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shldq $7, %rsi, %rdi # sched: [1:1.00]
-; SLM-NEXT:    shrdq $7, %rsi, %rdi # sched: [1:1.00]
-; SLM-NEXT:    shldq $7, %rsi, (%rdx) # sched: [4:2.00]
-; SLM-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    subw $511, %ax # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    subw $511, %di # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    subw $7, %di # sched: [1:0.50]
+; SLM-NEXT:    subw $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    subw %di, %di # sched: [1:0.50]
+; SLM-NEXT:    subw %di, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    subw (%rsi), %di # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_shld_shrd_64:
+; SANDY-LABEL: test_sub_16:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    shldq %cl, %rsi, %rdi # sched: [4:1.50]
-; SANDY-NEXT:    shrdq %cl, %rsi, %rdi # sched: [4:1.50]
-; SANDY-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [10:1.50]
-; SANDY-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [10:1.50]
-; SANDY-NEXT:    shldq $7, %rsi, %rdi # sched: [2:0.67]
-; SANDY-NEXT:    shrdq $7, %rsi, %rdi # sched: [2:0.67]
-; SANDY-NEXT:    shldq $7, %rsi, (%rdx) # sched: [8:1.00]
-; SANDY-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    subw $511, %ax # imm = 0x1FF
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    subw $511, %di # imm = 0x1FF
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    subw $7, %di # sched: [1:0.33]
+; SANDY-NEXT:    subw $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    subw %di, %di # sched: [1:0.33]
+; SANDY-NEXT:    subw %di, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    subw (%rsi), %di # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_shld_shrd_64:
+; HASWELL-LABEL: test_sub_16:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    shldq %cl, %rsi, %rdi # sched: [6:1.00]
-; HASWELL-NEXT:    shrdq %cl, %rsi, %rdi # sched: [6:1.00]
-; HASWELL-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [12:1.00]
-; HASWELL-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [12:1.00]
-; HASWELL-NEXT:    shldq $7, %rsi, %rdi # sched: [3:1.00]
-; HASWELL-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:1.00]
-; HASWELL-NEXT:    shldq $7, %rsi, (%rdx) # sched: [10:1.00]
-; HASWELL-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [10:1.00]
+; HASWELL-NEXT:    subw $511, %ax # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    subw $511, %di # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    subw $7, %di # sched: [1:0.25]
+; HASWELL-NEXT:    subw $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    subw %di, %di # sched: [1:0.25]
+; HASWELL-NEXT:    subw %di, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    subw (%rsi), %di # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_shld_shrd_64:
+; BROADWELL-LABEL: test_sub_16:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    shldq %cl, %rsi, %rdi # sched: [6:1.00]
-; BROADWELL-NEXT:    shrdq %cl, %rsi, %rdi # sched: [6:1.00]
-; BROADWELL-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [11:1.00]
-; BROADWELL-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [11:1.00]
-; BROADWELL-NEXT:    shldq $7, %rsi, %rdi # sched: [3:1.00]
-; BROADWELL-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:1.00]
-; BROADWELL-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:1.00]
-; BROADWELL-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:1.00]
+; BROADWELL-NEXT:    subw $511, %ax # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    subw $511, %di # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    subw $7, %di # sched: [1:0.25]
+; BROADWELL-NEXT:    subw $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    subw %di, %di # sched: [1:0.25]
+; BROADWELL-NEXT:    subw %di, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    subw (%rsi), %di # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_shld_shrd_64:
+; SKYLAKE-LABEL: test_sub_16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    shldq %cl, %rsi, %rdi # sched: [6:1.00]
-; SKYLAKE-NEXT:    shrdq %cl, %rsi, %rdi # sched: [6:1.00]
-; SKYLAKE-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [11:1.00]
-; SKYLAKE-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [11:1.00]
-; SKYLAKE-NEXT:    shldq $7, %rsi, %rdi # sched: [3:1.00]
-; SKYLAKE-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:1.00]
-; SKYLAKE-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:1.00]
-; SKYLAKE-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:1.00]
+; SKYLAKE-NEXT:    subw $511, %ax # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    subw $511, %di # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    subw $7, %di # sched: [1:0.25]
+; SKYLAKE-NEXT:    subw $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    subw %di, %di # sched: [1:0.25]
+; SKYLAKE-NEXT:    subw %di, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    subw (%rsi), %di # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_shld_shrd_64:
+; SKX-LABEL: test_sub_16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    shldq %cl, %rsi, %rdi # sched: [6:1.00]
-; SKX-NEXT:    shrdq %cl, %rsi, %rdi # sched: [6:1.00]
-; SKX-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [11:1.00]
-; SKX-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [11:1.00]
-; SKX-NEXT:    shldq $7, %rsi, %rdi # sched: [3:1.00]
-; SKX-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:1.00]
-; SKX-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:1.00]
-; SKX-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:1.00]
+; SKX-NEXT:    subw $511, %ax # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    subw $511, %di # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    subw $7, %di # sched: [1:0.25]
+; SKX-NEXT:    subw $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    subw %di, %di # sched: [1:0.25]
+; SKX-NEXT:    subw %di, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    subw (%rsi), %di # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_shld_shrd_64:
+; BTVER2-LABEL: test_sub_16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    shldq %cl, %rsi, %rdi # sched: [4:4.00]
-; BTVER2-NEXT:    shrdq %cl, %rsi, %rdi # sched: [4:4.00]
-; BTVER2-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [9:11.00]
-; BTVER2-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [9:11.00]
-; BTVER2-NEXT:    shldq $7, %rsi, %rdi # sched: [3:3.00]
-; BTVER2-NEXT:    shrdq $7, %rsi, %rdi # sched: [3:3.00]
-; BTVER2-NEXT:    shldq $7, %rsi, (%rdx) # sched: [9:11.00]
-; BTVER2-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [9:11.00]
+; BTVER2-NEXT:    subw $511, %ax # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    subw $511, %di # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    subw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    subw $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    subw %di, %di # sched: [1:0.50]
+; BTVER2-NEXT:    subw %di, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    subw (%rsi), %di # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_shld_shrd_64:
+; ZNVER1-LABEL: test_sub_16:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    shldq %cl, %rsi, %rdi # sched: [100:?]
-; ZNVER1-NEXT:    shrdq %cl, %rsi, %rdi # sched: [100:?]
-; ZNVER1-NEXT:    shldq %cl, %rsi, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    shrdq %cl, %rsi, (%rdx) # sched: [100:?]
-; ZNVER1-NEXT:    shldq $7, %rsi, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    shrdq $7, %rsi, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    shldq $7, %rsi, (%rdx) # sched: [5:0.50]
-; ZNVER1-NEXT:    shrdq $7, %rsi, (%rdx) # sched: [5:0.50]
+; ZNVER1-NEXT:    subw $511, %ax # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    subw $511, %di # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    subw $511, (%rsi) # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    subw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    subw $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    subw %di, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    subw %di, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    subw (%rsi), %di # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "shld $1, $0 \0A\09 shrd $1, $0 \0A\09 shld $1, $2 \0A\09 shrd $1, $2 \0A\09 shld $3, $1, $0 \0A\09 shrd $3, $1, $0 \0A\09 shld $3, $1, $2 \0A\09 shrd $3, $1, $2", "r,r,*m,i"(i64 %a0, i64 %a1, i64 *%a2, i8 7)
+  tail call void asm "subw $2, %AX \0A\09 subw $2, $0 \0A\09 subw $2, $1 \0A\09 subw $3, $0 \0A\09 subw $3, $1 \0A\09 subw $0, $0 \0A\09 subw $0, $1 \0A\09 subw $1, $0", "r,*m,i,i"(i16 %a0, i16* %a1, i16 511, i8 7) nounwind
   ret void
 }
-
-define void @test_stc_std() optsize {
-; GENERIC-LABEL: test_stc_std:
+define void @test_sub_32(i32 %a0, i32* %a1) optsize {
+; GENERIC-LABEL: test_sub_32:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    stc # sched: [1:0.33]
-; GENERIC-NEXT:    std # sched: [1:0.33]
+; GENERIC-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    subl $7, %edi # sched: [1:0.33]
+; GENERIC-NEXT:    subl $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    subl %edi, %edi # sched: [1:0.33]
+; GENERIC-NEXT:    subl %edi, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_stc_std:
+; ATOM-LABEL: test_sub_32:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    stc # sched: [1:0.50]
-; ATOM-NEXT:    std # sched: [21:10.50]
+; ATOM-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    subl $7, %edi # sched: [1:0.50]
+; ATOM-NEXT:    subl $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    subl %edi, %edi # sched: [1:0.50]
+; ATOM-NEXT:    subl %edi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    subl (%rsi), %edi # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_stc_std:
+; SLM-LABEL: test_sub_32:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    stc # sched: [1:0.50]
-; SLM-NEXT:    std # sched: [1:0.50]
+; SLM-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    subl $7, %edi # sched: [1:0.50]
+; SLM-NEXT:    subl $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    subl %edi, %edi # sched: [1:0.50]
+; SLM-NEXT:    subl %edi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    subl (%rsi), %edi # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_stc_std:
+; SANDY-LABEL: test_sub_32:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    stc # sched: [1:0.33]
-; SANDY-NEXT:    std # sched: [1:0.33]
+; SANDY-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    subl $7, %edi # sched: [1:0.33]
+; SANDY-NEXT:    subl $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    subl %edi, %edi # sched: [1:0.33]
+; SANDY-NEXT:    subl %edi, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_stc_std:
+; HASWELL-LABEL: test_sub_32:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    stc # sched: [1:0.25]
-; HASWELL-NEXT:    std # sched: [6:1.50]
+; HASWELL-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    subl $7, %edi # sched: [1:0.25]
+; HASWELL-NEXT:    subl $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    subl %edi, %edi # sched: [1:0.25]
+; HASWELL-NEXT:    subl %edi, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_stc_std:
+; BROADWELL-LABEL: test_sub_32:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    stc # sched: [1:0.25]
-; BROADWELL-NEXT:    std # sched: [6:1.50]
+; BROADWELL-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    subl $7, %edi # sched: [1:0.25]
+; BROADWELL-NEXT:    subl $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    subl %edi, %edi # sched: [1:0.25]
+; BROADWELL-NEXT:    subl %edi, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_stc_std:
+; SKYLAKE-LABEL: test_sub_32:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    stc # sched: [1:0.25]
-; SKYLAKE-NEXT:    std # sched: [6:1.50]
+; SKYLAKE-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    subl $7, %edi # sched: [1:0.25]
+; SKYLAKE-NEXT:    subl $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    subl %edi, %edi # sched: [1:0.25]
+; SKYLAKE-NEXT:    subl %edi, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_stc_std:
+; SKX-LABEL: test_sub_32:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    stc # sched: [1:0.25]
-; SKX-NEXT:    std # sched: [6:1.50]
+; SKX-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    subl $7, %edi # sched: [1:0.25]
+; SKX-NEXT:    subl $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    subl %edi, %edi # sched: [1:0.25]
+; SKX-NEXT:    subl %edi, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_stc_std:
+; BTVER2-LABEL: test_sub_32:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    stc # sched: [1:0.50]
-; BTVER2-NEXT:    std # sched: [1:0.50]
+; BTVER2-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    subl $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    subl $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    subl %edi, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    subl %edi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    subl (%rsi), %edi # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_stc_std:
+; ZNVER1-LABEL: test_sub_32:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    stc # sched: [1:0.25]
-; ZNVER1-NEXT:    std # sched: [1:0.25]
+; ZNVER1-NEXT:    subl $665536, %eax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    subl $665536, %edi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    subl $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    subl $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    subl %edi, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    subl %edi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    subl (%rsi), %edi # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "stc \0A\09 std", ""()
+  tail call void asm "subl $2, %EAX \0A\09 subl $2, $0 \0A\09 subl $2, $1 \0A\09 subl $3, $0 \0A\09 subl $3, $1 \0A\09 subl $0, $0 \0A\09 subl $0, $1 \0A\09 subl $1, $0", "r,*m,i,i"(i32 %a0, i32* %a1, i32 665536, i8 7) nounwind
   ret void
 }
-
-define void @test_stos() optsize {
-; GENERIC-LABEL: test_stos:
+define void @test_sub_64(i64 %a0, i64* %a1) optsize {
+; GENERIC-LABEL: test_sub_64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    stosb %al, %es:(%rdi) # sched: [5:1.00]
-; GENERIC-NEXT:    stosw %ax, %es:(%rdi) # sched: [5:1.00]
-; GENERIC-NEXT:    stosl %eax, %es:(%rdi) # sched: [5:1.00]
-; GENERIC-NEXT:    stosq %rax, %es:(%rdi) # sched: [5:1.00]
+; GENERIC-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    subq $7, %rdi # sched: [1:0.33]
+; GENERIC-NEXT:    subq $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    subq %rdi, %rdi # sched: [1:0.33]
+; GENERIC-NEXT:    subq %rdi, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_stos:
+; ATOM-LABEL: test_sub_64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    stosb %al, %es:(%rdi) # sched: [1:0.50]
-; ATOM-NEXT:    stosw %ax, %es:(%rdi) # sched: [1:0.50]
-; ATOM-NEXT:    stosl %eax, %es:(%rdi) # sched: [1:0.50]
-; ATOM-NEXT:    stosq %rax, %es:(%rdi) # sched: [1:0.50]
+; ATOM-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    subq $7, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    subq $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    subq %rdi, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    subq %rdi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    subq (%rsi), %rdi # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_stos:
+; SLM-LABEL: test_sub_64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    stosb %al, %es:(%rdi) # sched: [100:1.00]
-; SLM-NEXT:    stosw %ax, %es:(%rdi) # sched: [100:1.00]
-; SLM-NEXT:    stosl %eax, %es:(%rdi) # sched: [100:1.00]
-; SLM-NEXT:    stosq %rax, %es:(%rdi) # sched: [100:1.00]
+; SLM-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    subq $7, %rdi # sched: [1:0.50]
+; SLM-NEXT:    subq $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    subq %rdi, %rdi # sched: [1:0.50]
+; SLM-NEXT:    subq %rdi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    subq (%rsi), %rdi # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_stos:
+; SANDY-LABEL: test_sub_64:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    stosb %al, %es:(%rdi) # sched: [5:1.00]
-; SANDY-NEXT:    stosw %ax, %es:(%rdi) # sched: [5:1.00]
-; SANDY-NEXT:    stosl %eax, %es:(%rdi) # sched: [5:1.00]
-; SANDY-NEXT:    stosq %rax, %es:(%rdi) # sched: [5:1.00]
+; SANDY-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    subq $7, %rdi # sched: [1:0.33]
+; SANDY-NEXT:    subq $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    subq %rdi, %rdi # sched: [1:0.33]
+; SANDY-NEXT:    subq %rdi, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_stos:
+; HASWELL-LABEL: test_sub_64:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    stosb %al, %es:(%rdi) # sched: [2:1.00]
-; HASWELL-NEXT:    stosw %ax, %es:(%rdi) # sched: [2:1.00]
-; HASWELL-NEXT:    stosl %eax, %es:(%rdi) # sched: [2:1.00]
-; HASWELL-NEXT:    stosq %rax, %es:(%rdi) # sched: [2:1.00]
+; HASWELL-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    subq $7, %rdi # sched: [1:0.25]
+; HASWELL-NEXT:    subq $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
+; HASWELL-NEXT:    subq %rdi, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_stos:
+; BROADWELL-LABEL: test_sub_64:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    stosb %al, %es:(%rdi) # sched: [2:1.00]
-; BROADWELL-NEXT:    stosw %ax, %es:(%rdi) # sched: [2:1.00]
-; BROADWELL-NEXT:    stosl %eax, %es:(%rdi) # sched: [2:1.00]
-; BROADWELL-NEXT:    stosq %rax, %es:(%rdi) # sched: [2:1.00]
+; BROADWELL-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    subq $7, %rdi # sched: [1:0.25]
+; BROADWELL-NEXT:    subq $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
+; BROADWELL-NEXT:    subq %rdi, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_stos:
+; SKYLAKE-LABEL: test_sub_64:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    stosb %al, %es:(%rdi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    stosw %ax, %es:(%rdi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    stosl %eax, %es:(%rdi) # sched: [2:1.00]
-; SKYLAKE-NEXT:    stosq %rax, %es:(%rdi) # sched: [2:1.00]
+; SKYLAKE-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    subq $7, %rdi # sched: [1:0.25]
+; SKYLAKE-NEXT:    subq $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
+; SKYLAKE-NEXT:    subq %rdi, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_stos:
+; SKX-LABEL: test_sub_64:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    stosb %al, %es:(%rdi) # sched: [2:1.00]
-; SKX-NEXT:    stosw %ax, %es:(%rdi) # sched: [2:1.00]
-; SKX-NEXT:    stosl %eax, %es:(%rdi) # sched: [2:1.00]
-; SKX-NEXT:    stosq %rax, %es:(%rdi) # sched: [2:1.00]
+; SKX-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    subq $7, %rdi # sched: [1:0.25]
+; SKX-NEXT:    subq $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
+; SKX-NEXT:    subq %rdi, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_stos:
+; BTVER2-LABEL: test_sub_64:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    stosb %al, %es:(%rdi) # sched: [100:0.17]
-; BTVER2-NEXT:    stosw %ax, %es:(%rdi) # sched: [100:0.17]
-; BTVER2-NEXT:    stosl %eax, %es:(%rdi) # sched: [100:0.17]
-; BTVER2-NEXT:    stosq %rax, %es:(%rdi) # sched: [100:0.17]
+; BTVER2-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    subq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    subq $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    subq %rdi, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    subq %rdi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    subq (%rsi), %rdi # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_stos:
+; ZNVER1-LABEL: test_sub_64:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    stosb %al, %es:(%rdi) # sched: [100:?]
-; ZNVER1-NEXT:    stosw %ax, %es:(%rdi) # sched: [100:?]
-; ZNVER1-NEXT:    stosl %eax, %es:(%rdi) # sched: [100:?]
-; ZNVER1-NEXT:    stosq %rax, %es:(%rdi) # sched: [100:?]
+; ZNVER1-NEXT:    subq $665536, %rax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    subq $665536, %rdi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    subq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    subq $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    subq %rdi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    subq (%rsi), %rdi # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "stosb \0A\09 stosw \0A\09 stosl \0A\09 stosq", ""()
+  tail call void asm "subq $2, %RAX \0A\09 subq $2, $0 \0A\09 subq $2, $1 \0A\09 subq $3, $0 \0A\09 subq $3, $1 \0A\09 subq $0, $0 \0A\09 subq $0, $1 \0A\09 subq $1, $0", "r,*m,i,i"(i64 %a0, i64* %a1, i32 665536, i8 7) nounwind
   ret void
 }
 
-define void @test_sub_8(i8 %a0, i8* %a1) optsize {
-; GENERIC-LABEL: test_sub_8:
+; TODO - test_test
+
+; TODO: ud0, ud1
+define void @test_ud2() optsize {
+; GENERIC-LABEL: test_ud2:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    subb $7, %al # sched: [1:0.33]
-; GENERIC-NEXT:    subb $7, %dil # sched: [1:0.33]
-; GENERIC-NEXT:    subb $7, (%rsi) # sched: [7:1.00]
-; GENERIC-NEXT:    subb %dil, %dil # sched: [1:0.33]
-; GENERIC-NEXT:    subb %dil, (%rsi) # sched: [7:1.00]
-; GENERIC-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
+; GENERIC-NEXT:    ud2 # sched: [100:0.33]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sub_8:
+; ATOM-LABEL: test_ud2:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    subb $7, %al # sched: [1:0.50]
-; ATOM-NEXT:    subb $7, %dil # sched: [1:0.50]
-; ATOM-NEXT:    subb $7, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    subb %dil, %dil # sched: [1:0.50]
-; ATOM-NEXT:    subb %dil, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    subb (%rsi), %dil # sched: [1:1.00]
+; ATOM-NEXT:    ud2
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sub_8:
+; SLM-LABEL: test_ud2:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    subb $7, %al # sched: [1:0.50]
-; SLM-NEXT:    subb $7, %dil # sched: [1:0.50]
-; SLM-NEXT:    subb $7, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    subb %dil, %dil # sched: [1:0.50]
-; SLM-NEXT:    subb %dil, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    subb (%rsi), %dil # sched: [4:1.00]
+; SLM-NEXT:    ud2 # sched: [100:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sub_8:
+; SANDY-LABEL: test_ud2:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    subb $7, %al # sched: [1:0.33]
-; SANDY-NEXT:    subb $7, %dil # sched: [1:0.33]
-; SANDY-NEXT:    subb $7, (%rsi) # sched: [7:1.00]
-; SANDY-NEXT:    subb %dil, %dil # sched: [1:0.33]
-; SANDY-NEXT:    subb %dil, (%rsi) # sched: [7:1.00]
-; SANDY-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
+; SANDY-NEXT:    ud2 # sched: [100:0.33]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sub_8:
+; HASWELL-LABEL: test_ud2:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    subb $7, %al # sched: [1:0.25]
-; HASWELL-NEXT:    subb $7, %dil # sched: [1:0.25]
-; HASWELL-NEXT:    subb $7, (%rsi) # sched: [7:1.00]
-; HASWELL-NEXT:    subb %dil, %dil # sched: [1:0.25]
-; HASWELL-NEXT:    subb %dil, (%rsi) # sched: [7:1.00]
-; HASWELL-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
+; HASWELL-NEXT:    ud2 # sched: [100:0.25]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sub_8:
+; BROADWELL-LABEL: test_ud2:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    subb $7, %al # sched: [1:0.25]
-; BROADWELL-NEXT:    subb $7, %dil # sched: [1:0.25]
-; BROADWELL-NEXT:    subb $7, (%rsi) # sched: [6:1.00]
-; BROADWELL-NEXT:    subb %dil, %dil # sched: [1:0.25]
-; BROADWELL-NEXT:    subb %dil, (%rsi) # sched: [6:1.00]
-; BROADWELL-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
+; BROADWELL-NEXT:    ud2 # sched: [100:0.25]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sub_8:
+; SKYLAKE-LABEL: test_ud2:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    subb $7, %al # sched: [1:0.25]
-; SKYLAKE-NEXT:    subb $7, %dil # sched: [1:0.25]
-; SKYLAKE-NEXT:    subb $7, (%rsi) # sched: [6:1.00]
-; SKYLAKE-NEXT:    subb %dil, %dil # sched: [1:0.25]
-; SKYLAKE-NEXT:    subb %dil, (%rsi) # sched: [6:1.00]
-; SKYLAKE-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
+; SKYLAKE-NEXT:    ud2 # sched: [100:0.25]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sub_8:
+; SKX-LABEL: test_ud2:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    subb $7, %al # sched: [1:0.25]
-; SKX-NEXT:    subb $7, %dil # sched: [1:0.25]
-; SKX-NEXT:    subb $7, (%rsi) # sched: [6:1.00]
-; SKX-NEXT:    subb %dil, %dil # sched: [1:0.25]
-; SKX-NEXT:    subb %dil, (%rsi) # sched: [6:1.00]
-; SKX-NEXT:    subb (%rsi), %dil # sched: [6:0.50]
+; SKX-NEXT:    ud2 # sched: [100:0.25]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sub_8:
+; BTVER2-LABEL: test_ud2:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    subb $7, %al # sched: [1:0.50]
-; BTVER2-NEXT:    subb $7, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    subb $7, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    subb %dil, %dil # sched: [1:0.50]
-; BTVER2-NEXT:    subb %dil, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    subb (%rsi), %dil # sched: [4:1.00]
+; BTVER2-NEXT:    ud2 # sched: [100:0.17]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sub_8:
+; ZNVER1-LABEL: test_ud2:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    subb $7, %al # sched: [1:0.25]
-; ZNVER1-NEXT:    subb $7, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    subb $7, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    subb %dil, %dil # sched: [1:0.25]
-; ZNVER1-NEXT:    subb %dil, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    subb (%rsi), %dil # sched: [5:0.50]
+; ZNVER1-NEXT:    ud2 # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "subb $2, %AL \0A\09 subb $2, $0 \0A\09 subb $2, $1 \0A\09 subb $0, $0 \0A\09 subb $0, $1 \0A\09 subb $1, $0", "r,*m,i"(i8 %a0, i8* %a1, i8 7) nounwind
+  call void asm sideeffect "ud2", ""()
   ret void
 }
-define void @test_sub_16(i16 %a0, i16* %a1) optsize {
-; GENERIC-LABEL: test_sub_16:
+
+define void @test_xadd_8(i8 %a0, i8 %a1, i8 *%a2) optsize {
+; GENERIC-LABEL: test_xadd_8:
 ; GENERIC:       # %bb.0:
-; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    subw $511, %ax # imm = 0x1FF
-; GENERIC-NEXT:    # sched: [1:0.33]
-; GENERIC-NEXT:    subw $511, %di # imm = 0x1FF
-; GENERIC-NEXT:    # sched: [1:0.33]
-; GENERIC-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; GENERIC-NEXT:    # sched: [7:1.00]
-; GENERIC-NEXT:    subw $7, %di # sched: [1:0.33]
-; GENERIC-NEXT:    subw $7, (%rsi) # sched: [7:1.00]
-; GENERIC-NEXT:    subw %di, %di # sched: [1:0.33]
-; GENERIC-NEXT:    subw %di, (%rsi) # sched: [7:1.00]
-; GENERIC-NEXT:    subw (%rsi), %di # sched: [6:0.50]
-; GENERIC-NEXT:    #NO_APP
-; GENERIC-NEXT:    retq # sched: [1:1.00]
-;
-; ATOM-LABEL: test_sub_16:
-; ATOM:       # %bb.0:
-; ATOM-NEXT:    #APP
-; ATOM-NEXT:    subw $511, %ax # imm = 0x1FF
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    subw $511, %di # imm = 0x1FF
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; ATOM-NEXT:    # sched: [1:1.00]
-; ATOM-NEXT:    subw $7, %di # sched: [1:0.50]
-; ATOM-NEXT:    subw $7, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    subw %di, %di # sched: [1:0.50]
-; ATOM-NEXT:    subw %di, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    subw (%rsi), %di # sched: [1:1.00]
+; GENERIC-NEXT:    #APP
+; GENERIC-NEXT:    xaddb %dil, %sil # sched: [3:1.00]
+; GENERIC-NEXT:    xaddb %dil, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    #NO_APP
+; GENERIC-NEXT:    retq # sched: [1:1.00]
+;
+; ATOM-LABEL: test_xadd_8:
+; ATOM:       # %bb.0:
+; ATOM-NEXT:    #APP
+; ATOM-NEXT:    xaddb %dil, %sil # sched: [2:1.00]
+; ATOM-NEXT:    xaddb %dil, (%rdx) # sched: [3:1.50]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sub_16:
+; SLM-LABEL: test_xadd_8:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    subw $511, %ax # imm = 0x1FF
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    subw $511, %di # imm = 0x1FF
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; SLM-NEXT:    # sched: [4:2.00]
-; SLM-NEXT:    subw $7, %di # sched: [1:0.50]
-; SLM-NEXT:    subw $7, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    subw %di, %di # sched: [1:0.50]
-; SLM-NEXT:    subw %di, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    subw (%rsi), %di # sched: [4:1.00]
+; SLM-NEXT:    xaddb %dil, %sil # sched: [1:0.50]
+; SLM-NEXT:    xaddb %dil, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sub_16:
+; SANDY-LABEL: test_xadd_8:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    subw $511, %ax # imm = 0x1FF
-; SANDY-NEXT:    # sched: [1:0.33]
-; SANDY-NEXT:    subw $511, %di # imm = 0x1FF
-; SANDY-NEXT:    # sched: [1:0.33]
-; SANDY-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; SANDY-NEXT:    # sched: [7:1.00]
-; SANDY-NEXT:    subw $7, %di # sched: [1:0.33]
-; SANDY-NEXT:    subw $7, (%rsi) # sched: [7:1.00]
-; SANDY-NEXT:    subw %di, %di # sched: [1:0.33]
-; SANDY-NEXT:    subw %di, (%rsi) # sched: [7:1.00]
-; SANDY-NEXT:    subw (%rsi), %di # sched: [6:0.50]
+; SANDY-NEXT:    xaddb %dil, %sil # sched: [3:1.00]
+; SANDY-NEXT:    xaddb %dil, (%rdx) # sched: [8:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sub_16:
+; HASWELL-LABEL: test_xadd_8:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    subw $511, %ax # imm = 0x1FF
-; HASWELL-NEXT:    # sched: [1:0.25]
-; HASWELL-NEXT:    subw $511, %di # imm = 0x1FF
-; HASWELL-NEXT:    # sched: [1:0.25]
-; HASWELL-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; HASWELL-NEXT:    # sched: [7:1.00]
-; HASWELL-NEXT:    subw $7, %di # sched: [1:0.25]
-; HASWELL-NEXT:    subw $7, (%rsi) # sched: [7:1.00]
-; HASWELL-NEXT:    subw %di, %di # sched: [1:0.25]
-; HASWELL-NEXT:    subw %di, (%rsi) # sched: [7:1.00]
-; HASWELL-NEXT:    subw (%rsi), %di # sched: [6:0.50]
+; HASWELL-NEXT:    xaddb %dil, %sil # sched: [3:0.75]
+; HASWELL-NEXT:    xaddb %dil, (%rdx) # sched: [8:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sub_16:
+; BROADWELL-LABEL: test_xadd_8:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    subw $511, %ax # imm = 0x1FF
-; BROADWELL-NEXT:    # sched: [1:0.25]
-; BROADWELL-NEXT:    subw $511, %di # imm = 0x1FF
-; BROADWELL-NEXT:    # sched: [1:0.25]
-; BROADWELL-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; BROADWELL-NEXT:    # sched: [6:1.00]
-; BROADWELL-NEXT:    subw $7, %di # sched: [1:0.25]
-; BROADWELL-NEXT:    subw $7, (%rsi) # sched: [6:1.00]
-; BROADWELL-NEXT:    subw %di, %di # sched: [1:0.25]
-; BROADWELL-NEXT:    subw %di, (%rsi) # sched: [6:1.00]
-; BROADWELL-NEXT:    subw (%rsi), %di # sched: [6:0.50]
+; BROADWELL-NEXT:    xaddb %dil, %sil # sched: [3:0.75]
+; BROADWELL-NEXT:    xaddb %dil, (%rdx) # sched: [7:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sub_16:
+; SKYLAKE-LABEL: test_xadd_8:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    subw $511, %ax # imm = 0x1FF
-; SKYLAKE-NEXT:    # sched: [1:0.25]
-; SKYLAKE-NEXT:    subw $511, %di # imm = 0x1FF
-; SKYLAKE-NEXT:    # sched: [1:0.25]
-; SKYLAKE-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; SKYLAKE-NEXT:    # sched: [6:1.00]
-; SKYLAKE-NEXT:    subw $7, %di # sched: [1:0.25]
-; SKYLAKE-NEXT:    subw $7, (%rsi) # sched: [6:1.00]
-; SKYLAKE-NEXT:    subw %di, %di # sched: [1:0.25]
-; SKYLAKE-NEXT:    subw %di, (%rsi) # sched: [6:1.00]
-; SKYLAKE-NEXT:    subw (%rsi), %di # sched: [6:0.50]
+; SKYLAKE-NEXT:    xaddb %dil, %sil # sched: [3:0.75]
+; SKYLAKE-NEXT:    xaddb %dil, (%rdx) # sched: [7:1.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sub_16:
+; SKX-LABEL: test_xadd_8:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    subw $511, %ax # imm = 0x1FF
-; SKX-NEXT:    # sched: [1:0.25]
-; SKX-NEXT:    subw $511, %di # imm = 0x1FF
-; SKX-NEXT:    # sched: [1:0.25]
-; SKX-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; SKX-NEXT:    # sched: [6:1.00]
-; SKX-NEXT:    subw $7, %di # sched: [1:0.25]
-; SKX-NEXT:    subw $7, (%rsi) # sched: [6:1.00]
-; SKX-NEXT:    subw %di, %di # sched: [1:0.25]
-; SKX-NEXT:    subw %di, (%rsi) # sched: [6:1.00]
-; SKX-NEXT:    subw (%rsi), %di # sched: [6:0.50]
+; SKX-NEXT:    xaddb %dil, %sil # sched: [3:0.75]
+; SKX-NEXT:    xaddb %dil, (%rdx) # sched: [7:1.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sub_16:
+; BTVER2-LABEL: test_xadd_8:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    subw $511, %ax # imm = 0x1FF
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    subw $511, %di # imm = 0x1FF
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; BTVER2-NEXT:    # sched: [4:1.00]
-; BTVER2-NEXT:    subw $7, %di # sched: [1:0.50]
-; BTVER2-NEXT:    subw $7, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    subw %di, %di # sched: [1:0.50]
-; BTVER2-NEXT:    subw %di, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    subw (%rsi), %di # sched: [4:1.00]
+; BTVER2-NEXT:    xaddb %dil, %sil # sched: [1:0.50]
+; BTVER2-NEXT:    xaddb %dil, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sub_16:
+; ZNVER1-LABEL: test_xadd_8:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    subw $511, %ax # imm = 0x1FF
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    subw $511, %di # imm = 0x1FF
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    subw $511, (%rsi) # imm = 0x1FF
-; ZNVER1-NEXT:    # sched: [5:0.50]
-; ZNVER1-NEXT:    subw $7, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    subw $7, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    subw %di, %di # sched: [1:0.25]
-; ZNVER1-NEXT:    subw %di, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    subw (%rsi), %di # sched: [5:0.50]
+; ZNVER1-NEXT:    xaddb %dil, %sil # sched: [1:0.25]
+; ZNVER1-NEXT:    xaddb %dil, (%rdx) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "subw $2, %AX \0A\09 subw $2, $0 \0A\09 subw $2, $1 \0A\09 subw $3, $0 \0A\09 subw $3, $1 \0A\09 subw $0, $0 \0A\09 subw $0, $1 \0A\09 subw $1, $0", "r,*m,i,i"(i16 %a0, i16* %a1, i16 511, i8 7) nounwind
+  tail call void asm "xaddb $0, $1 \0A\09 xaddb $0, $2", "r,r,*m"(i8 %a0, i8 %a1, i8 *%a2) nounwind
   ret void
 }
-define void @test_sub_32(i32 %a0, i32* %a1) optsize {
-; GENERIC-LABEL: test_sub_32:
+define void @test_xadd_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
+; GENERIC-LABEL: test_xadd_16:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [1:0.33]
-; GENERIC-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [1:0.33]
-; GENERIC-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [7:1.00]
-; GENERIC-NEXT:    subl $7, %edi # sched: [1:0.33]
-; GENERIC-NEXT:    subl $7, (%rsi) # sched: [7:1.00]
-; GENERIC-NEXT:    subl %edi, %edi # sched: [1:0.33]
-; GENERIC-NEXT:    subl %edi, (%rsi) # sched: [7:1.00]
-; GENERIC-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
+; GENERIC-NEXT:    xaddw %di, %si # sched: [3:1.00]
+; GENERIC-NEXT:    xaddw %di, (%rdx) # sched: [8:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sub_32:
+; ATOM-LABEL: test_xadd_16:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:1.00]
-; ATOM-NEXT:    subl $7, %edi # sched: [1:0.50]
-; ATOM-NEXT:    subl $7, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    subl %edi, %edi # sched: [1:0.50]
-; ATOM-NEXT:    subl %edi, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    subl (%rsi), %edi # sched: [1:1.00]
+; ATOM-NEXT:    xaddw %di, %si # sched: [2:1.00]
+; ATOM-NEXT:    xaddw %di, (%rdx) # sched: [3:1.50]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sub_32:
+; SLM-LABEL: test_xadd_16:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; SLM-NEXT:    # sched: [4:2.00]
-; SLM-NEXT:    subl $7, %edi # sched: [1:0.50]
-; SLM-NEXT:    subl $7, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    subl %edi, %edi # sched: [1:0.50]
-; SLM-NEXT:    subl %edi, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    subl (%rsi), %edi # sched: [4:1.00]
+; SLM-NEXT:    xaddw %di, %si # sched: [1:0.50]
+; SLM-NEXT:    xaddw %di, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sub_32:
+; SANDY-LABEL: test_xadd_16:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [1:0.33]
-; SANDY-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [1:0.33]
-; SANDY-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [7:1.00]
-; SANDY-NEXT:    subl $7, %edi # sched: [1:0.33]
-; SANDY-NEXT:    subl $7, (%rsi) # sched: [7:1.00]
-; SANDY-NEXT:    subl %edi, %edi # sched: [1:0.33]
-; SANDY-NEXT:    subl %edi, (%rsi) # sched: [7:1.00]
-; SANDY-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
+; SANDY-NEXT:    xaddw %di, %si # sched: [3:1.00]
+; SANDY-NEXT:    xaddw %di, (%rdx) # sched: [8:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sub_32:
+; HASWELL-LABEL: test_xadd_16:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [1:0.25]
-; HASWELL-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [1:0.25]
-; HASWELL-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [7:1.00]
-; HASWELL-NEXT:    subl $7, %edi # sched: [1:0.25]
-; HASWELL-NEXT:    subl $7, (%rsi) # sched: [7:1.00]
-; HASWELL-NEXT:    subl %edi, %edi # sched: [1:0.25]
-; HASWELL-NEXT:    subl %edi, (%rsi) # sched: [7:1.00]
-; HASWELL-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
+; HASWELL-NEXT:    xaddw %di, %si # sched: [3:0.75]
+; HASWELL-NEXT:    xaddw %di, (%rdx) # sched: [8:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sub_32:
+; BROADWELL-LABEL: test_xadd_16:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [1:0.25]
-; BROADWELL-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [1:0.25]
-; BROADWELL-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [6:1.00]
-; BROADWELL-NEXT:    subl $7, %edi # sched: [1:0.25]
-; BROADWELL-NEXT:    subl $7, (%rsi) # sched: [6:1.00]
-; BROADWELL-NEXT:    subl %edi, %edi # sched: [1:0.25]
-; BROADWELL-NEXT:    subl %edi, (%rsi) # sched: [6:1.00]
-; BROADWELL-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
+; BROADWELL-NEXT:    xaddw %di, %si # sched: [3:0.75]
+; BROADWELL-NEXT:    xaddw %di, (%rdx) # sched: [7:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sub_32:
+; SKYLAKE-LABEL: test_xadd_16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [1:0.25]
-; SKYLAKE-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [1:0.25]
-; SKYLAKE-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [6:1.00]
-; SKYLAKE-NEXT:    subl $7, %edi # sched: [1:0.25]
-; SKYLAKE-NEXT:    subl $7, (%rsi) # sched: [6:1.00]
-; SKYLAKE-NEXT:    subl %edi, %edi # sched: [1:0.25]
-; SKYLAKE-NEXT:    subl %edi, (%rsi) # sched: [6:1.00]
-; SKYLAKE-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
+; SKYLAKE-NEXT:    xaddw %di, %si # sched: [3:0.75]
+; SKYLAKE-NEXT:    xaddw %di, (%rdx) # sched: [7:1.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sub_32:
+; SKX-LABEL: test_xadd_16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; SKX-NEXT:    # sched: [1:0.25]
-; SKX-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; SKX-NEXT:    # sched: [1:0.25]
-; SKX-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; SKX-NEXT:    # sched: [6:1.00]
-; SKX-NEXT:    subl $7, %edi # sched: [1:0.25]
-; SKX-NEXT:    subl $7, (%rsi) # sched: [6:1.00]
-; SKX-NEXT:    subl %edi, %edi # sched: [1:0.25]
-; SKX-NEXT:    subl %edi, (%rsi) # sched: [6:1.00]
-; SKX-NEXT:    subl (%rsi), %edi # sched: [6:0.50]
+; SKX-NEXT:    xaddw %di, %si # sched: [3:0.75]
+; SKX-NEXT:    xaddw %di, (%rdx) # sched: [7:1.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sub_32:
+; BTVER2-LABEL: test_xadd_16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [4:1.00]
-; BTVER2-NEXT:    subl $7, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    subl $7, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    subl %edi, %edi # sched: [1:0.50]
-; BTVER2-NEXT:    subl %edi, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    subl (%rsi), %edi # sched: [4:1.00]
+; BTVER2-NEXT:    xaddw %di, %si # sched: [1:0.50]
+; BTVER2-NEXT:    xaddw %di, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sub_32:
+; ZNVER1-LABEL: test_xadd_16:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    subl $665536, %eax # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    subl $665536, %edi # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    subl $665536, (%rsi) # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [5:0.50]
-; ZNVER1-NEXT:    subl $7, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    subl $7, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    subl %edi, %edi # sched: [1:0.25]
-; ZNVER1-NEXT:    subl %edi, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    subl (%rsi), %edi # sched: [5:0.50]
+; ZNVER1-NEXT:    xaddw %di, %si # sched: [1:0.25]
+; ZNVER1-NEXT:    xaddw %di, (%rdx) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "subl $2, %EAX \0A\09 subl $2, $0 \0A\09 subl $2, $1 \0A\09 subl $3, $0 \0A\09 subl $3, $1 \0A\09 subl $0, $0 \0A\09 subl $0, $1 \0A\09 subl $1, $0", "r,*m,i,i"(i32 %a0, i32* %a1, i32 665536, i8 7) nounwind
+  tail call void asm "xaddw $0, $1 \0A\09 xaddw $0, $2", "r,r,*m"(i16 %a0, i16 %a1, i16 *%a2) nounwind
   ret void
 }
-define void @test_sub_64(i64 %a0, i64* %a1) optsize {
-; GENERIC-LABEL: test_sub_64:
+define void @test_xadd_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
+; GENERIC-LABEL: test_xadd_32:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [1:0.33]
-; GENERIC-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [1:0.33]
-; GENERIC-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; GENERIC-NEXT:    # sched: [7:1.00]
-; GENERIC-NEXT:    subq $7, %rdi # sched: [1:0.33]
-; GENERIC-NEXT:    subq $7, (%rsi) # sched: [7:1.00]
-; GENERIC-NEXT:    subq %rdi, %rdi # sched: [1:0.33]
-; GENERIC-NEXT:    subq %rdi, (%rsi) # sched: [7:1.00]
-; GENERIC-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
+; GENERIC-NEXT:    xaddl %edi, %esi # sched: [3:1.00]
+; GENERIC-NEXT:    xaddl %edi, (%rdx) # sched: [8:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_sub_64:
+; ATOM-LABEL: test_xadd_32:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:0.50]
-; ATOM-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; ATOM-NEXT:    # sched: [1:1.00]
-; ATOM-NEXT:    subq $7, %rdi # sched: [1:0.50]
-; ATOM-NEXT:    subq $7, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    subq %rdi, %rdi # sched: [1:0.50]
-; ATOM-NEXT:    subq %rdi, (%rsi) # sched: [1:1.00]
-; ATOM-NEXT:    subq (%rsi), %rdi # sched: [1:1.00]
+; ATOM-NEXT:    xaddl %edi, %esi # sched: [2:1.00]
+; ATOM-NEXT:    xaddl %edi, (%rdx) # sched: [3:1.50]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_sub_64:
+; SLM-LABEL: test_xadd_32:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; SLM-NEXT:    # sched: [1:0.50]
-; SLM-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; SLM-NEXT:    # sched: [4:2.00]
-; SLM-NEXT:    subq $7, %rdi # sched: [1:0.50]
-; SLM-NEXT:    subq $7, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    subq %rdi, %rdi # sched: [1:0.50]
-; SLM-NEXT:    subq %rdi, (%rsi) # sched: [4:2.00]
-; SLM-NEXT:    subq (%rsi), %rdi # sched: [4:1.00]
+; SLM-NEXT:    xaddl %edi, %esi # sched: [1:0.50]
+; SLM-NEXT:    xaddl %edi, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_sub_64:
+; SANDY-LABEL: test_xadd_32:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [1:0.33]
-; SANDY-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [1:0.33]
-; SANDY-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; SANDY-NEXT:    # sched: [7:1.00]
-; SANDY-NEXT:    subq $7, %rdi # sched: [1:0.33]
-; SANDY-NEXT:    subq $7, (%rsi) # sched: [7:1.00]
-; SANDY-NEXT:    subq %rdi, %rdi # sched: [1:0.33]
-; SANDY-NEXT:    subq %rdi, (%rsi) # sched: [7:1.00]
-; SANDY-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
+; SANDY-NEXT:    xaddl %edi, %esi # sched: [3:1.00]
+; SANDY-NEXT:    xaddl %edi, (%rdx) # sched: [8:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_sub_64:
+; HASWELL-LABEL: test_xadd_32:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [1:0.25]
-; HASWELL-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [1:0.25]
-; HASWELL-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; HASWELL-NEXT:    # sched: [7:1.00]
-; HASWELL-NEXT:    subq $7, %rdi # sched: [1:0.25]
-; HASWELL-NEXT:    subq $7, (%rsi) # sched: [7:1.00]
-; HASWELL-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
-; HASWELL-NEXT:    subq %rdi, (%rsi) # sched: [7:1.00]
-; HASWELL-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
+; HASWELL-NEXT:    xaddl %edi, %esi # sched: [3:0.75]
+; HASWELL-NEXT:    xaddl %edi, (%rdx) # sched: [8:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_sub_64:
+; BROADWELL-LABEL: test_xadd_32:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [1:0.25]
-; BROADWELL-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [1:0.25]
-; BROADWELL-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; BROADWELL-NEXT:    # sched: [6:1.00]
-; BROADWELL-NEXT:    subq $7, %rdi # sched: [1:0.25]
-; BROADWELL-NEXT:    subq $7, (%rsi) # sched: [6:1.00]
-; BROADWELL-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
-; BROADWELL-NEXT:    subq %rdi, (%rsi) # sched: [6:1.00]
-; BROADWELL-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
+; BROADWELL-NEXT:    xaddl %edi, %esi # sched: [3:0.75]
+; BROADWELL-NEXT:    xaddl %edi, (%rdx) # sched: [7:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_sub_64:
+; SKYLAKE-LABEL: test_xadd_32:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [1:0.25]
-; SKYLAKE-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [1:0.25]
-; SKYLAKE-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; SKYLAKE-NEXT:    # sched: [6:1.00]
-; SKYLAKE-NEXT:    subq $7, %rdi # sched: [1:0.25]
-; SKYLAKE-NEXT:    subq $7, (%rsi) # sched: [6:1.00]
-; SKYLAKE-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
-; SKYLAKE-NEXT:    subq %rdi, (%rsi) # sched: [6:1.00]
-; SKYLAKE-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
+; SKYLAKE-NEXT:    xaddl %edi, %esi # sched: [3:0.75]
+; SKYLAKE-NEXT:    xaddl %edi, (%rdx) # sched: [7:1.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_sub_64:
+; SKX-LABEL: test_xadd_32:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; SKX-NEXT:    # sched: [1:0.25]
-; SKX-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; SKX-NEXT:    # sched: [1:0.25]
-; SKX-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; SKX-NEXT:    # sched: [6:1.00]
-; SKX-NEXT:    subq $7, %rdi # sched: [1:0.25]
-; SKX-NEXT:    subq $7, (%rsi) # sched: [6:1.00]
-; SKX-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
-; SKX-NEXT:    subq %rdi, (%rsi) # sched: [6:1.00]
-; SKX-NEXT:    subq (%rsi), %rdi # sched: [6:0.50]
+; SKX-NEXT:    xaddl %edi, %esi # sched: [3:0.75]
+; SKX-NEXT:    xaddl %edi, (%rdx) # sched: [7:1.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_sub_64:
+; BTVER2-LABEL: test_xadd_32:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [1:0.50]
-; BTVER2-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; BTVER2-NEXT:    # sched: [4:1.00]
-; BTVER2-NEXT:    subq $7, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    subq $7, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    subq %rdi, %rdi # sched: [1:0.50]
-; BTVER2-NEXT:    subq %rdi, (%rsi) # sched: [4:1.00]
-; BTVER2-NEXT:    subq (%rsi), %rdi # sched: [4:1.00]
+; BTVER2-NEXT:    xaddl %edi, %esi # sched: [1:0.50]
+; BTVER2-NEXT:    xaddl %edi, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_sub_64:
+; ZNVER1-LABEL: test_xadd_32:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    subq $665536, %rax # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    subq $665536, %rdi # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [1:0.25]
-; ZNVER1-NEXT:    subq $665536, (%rsi) # imm = 0xA27C0
-; ZNVER1-NEXT:    # sched: [5:0.50]
-; ZNVER1-NEXT:    subq $7, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    subq $7, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    subq %rdi, %rdi # sched: [1:0.25]
-; ZNVER1-NEXT:    subq %rdi, (%rsi) # sched: [5:0.50]
-; ZNVER1-NEXT:    subq (%rsi), %rdi # sched: [5:0.50]
+; ZNVER1-NEXT:    xaddl %edi, %esi # sched: [1:0.25]
+; ZNVER1-NEXT:    xaddl %edi, (%rdx) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "subq $2, %RAX \0A\09 subq $2, $0 \0A\09 subq $2, $1 \0A\09 subq $3, $0 \0A\09 subq $3, $1 \0A\09 subq $0, $0 \0A\09 subq $0, $1 \0A\09 subq $1, $0", "r,*m,i,i"(i64 %a0, i64* %a1, i32 665536, i8 7) nounwind
+  tail call void asm "xaddl $0, $1 \0A\09 xaddl $0, $2", "r,r,*m"(i32 %a0, i32 %a1, i32 *%a2) nounwind
   ret void
 }
-
-; TODO - test_test
-
-; TODO: ud0, ud1
-define void @test_ud2() optsize {
-; GENERIC-LABEL: test_ud2:
+define void @test_xadd_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
+; GENERIC-LABEL: test_xadd_64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    ud2 # sched: [100:0.33]
+; GENERIC-NEXT:    xaddq %rdi, %rsi # sched: [3:1.00]
+; GENERIC-NEXT:    xaddq %rdi, (%rdx) # sched: [8:1.00]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_ud2:
+; ATOM-LABEL: test_xadd_64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    ud2
+; ATOM-NEXT:    xaddq %rdi, %rsi # sched: [2:1.00]
+; ATOM-NEXT:    xaddq %rdi, (%rdx) # sched: [3:1.50]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_ud2:
+; SLM-LABEL: test_xadd_64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    ud2 # sched: [100:1.00]
+; SLM-NEXT:    xaddq %rdi, %rsi # sched: [1:0.50]
+; SLM-NEXT:    xaddq %rdi, (%rdx) # sched: [4:2.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_ud2:
+; SANDY-LABEL: test_xadd_64:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    ud2 # sched: [100:0.33]
+; SANDY-NEXT:    xaddq %rdi, %rsi # sched: [3:1.00]
+; SANDY-NEXT:    xaddq %rdi, (%rdx) # sched: [8:1.00]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_ud2:
+; HASWELL-LABEL: test_xadd_64:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    ud2 # sched: [100:0.25]
+; HASWELL-NEXT:    xaddq %rdi, %rsi # sched: [3:0.75]
+; HASWELL-NEXT:    xaddq %rdi, (%rdx) # sched: [8:1.00]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_ud2:
+; BROADWELL-LABEL: test_xadd_64:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    ud2 # sched: [100:0.25]
+; BROADWELL-NEXT:    xaddq %rdi, %rsi # sched: [3:0.75]
+; BROADWELL-NEXT:    xaddq %rdi, (%rdx) # sched: [7:1.00]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_ud2:
+; SKYLAKE-LABEL: test_xadd_64:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    ud2 # sched: [100:0.25]
+; SKYLAKE-NEXT:    xaddq %rdi, %rsi # sched: [3:0.75]
+; SKYLAKE-NEXT:    xaddq %rdi, (%rdx) # sched: [7:1.00]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_ud2:
+; SKX-LABEL: test_xadd_64:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    ud2 # sched: [100:0.25]
+; SKX-NEXT:    xaddq %rdi, %rsi # sched: [3:0.75]
+; SKX-NEXT:    xaddq %rdi, (%rdx) # sched: [7:1.00]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_ud2:
+; BTVER2-LABEL: test_xadd_64:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    ud2 # sched: [100:0.17]
+; BTVER2-NEXT:    xaddq %rdi, %rsi # sched: [1:0.50]
+; BTVER2-NEXT:    xaddq %rdi, (%rdx) # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_ud2:
+; ZNVER1-LABEL: test_xadd_64:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    ud2 # sched: [100:?]
+; ZNVER1-NEXT:    xaddq %rdi, %rsi # sched: [1:0.25]
+; ZNVER1-NEXT:    xaddq %rdi, (%rdx) # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  call void asm sideeffect "ud2", ""()
+  tail call void asm "xaddq $0, $1 \0A\09 xaddq $0, $2", "r,r,*m"(i64 %a0, i64 %a1, i64 *%a2) nounwind
   ret void
 }
 
-define void @test_xadd_8(i8 %a0, i8 %a1, i8 *%a2) optsize {
-; GENERIC-LABEL: test_xadd_8:
+; TODO - test_xchg
+
+define void @test_xlat() optsize {
+; GENERIC-LABEL: test_xlat:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    xaddb %dil, %sil # sched: [3:1.00]
-; GENERIC-NEXT:    xaddb %dil, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    xlatb # sched: [4:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_xadd_8:
+; ATOM-LABEL: test_xlat:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    xaddb %dil, %sil # sched: [2:1.00]
-; ATOM-NEXT:    xaddb %dil, (%rdx) # sched: [3:1.50]
+; ATOM-NEXT:    xlatb # sched: [6:3.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_xadd_8:
+; SLM-LABEL: test_xlat:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    xaddb %dil, %sil # sched: [1:0.50]
-; SLM-NEXT:    xaddb %dil, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    xlatb # sched: [3:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_xadd_8:
+; SANDY-LABEL: test_xlat:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    xaddb %dil, %sil # sched: [3:1.00]
-; SANDY-NEXT:    xaddb %dil, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    xlatb # sched: [4:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_xadd_8:
+; HASWELL-LABEL: test_xlat:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    xaddb %dil, %sil # sched: [3:0.75]
-; HASWELL-NEXT:    xaddb %dil, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    xlatb # sched: [7:?]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_xadd_8:
+; BROADWELL-LABEL: test_xlat:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    xaddb %dil, %sil # sched: [3:0.75]
-; BROADWELL-NEXT:    xaddb %dil, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    xlatb # sched: [5:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_xadd_8:
+; SKYLAKE-LABEL: test_xlat:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    xaddb %dil, %sil # sched: [3:0.75]
-; SKYLAKE-NEXT:    xaddb %dil, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    xlatb # sched: [5:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_xadd_8:
+; SKX-LABEL: test_xlat:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    xaddb %dil, %sil # sched: [3:0.75]
-; SKX-NEXT:    xaddb %dil, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    xlatb # sched: [5:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_xadd_8:
+; BTVER2-LABEL: test_xlat:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    xaddb %dil, %sil # sched: [1:0.50]
-; BTVER2-NEXT:    xaddb %dil, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    xlatb # sched: [5:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_xadd_8:
+; ZNVER1-LABEL: test_xlat:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    xaddb %dil, %sil # sched: [1:0.25]
-; ZNVER1-NEXT:    xaddb %dil, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    xlatb # sched: [100:?]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "xaddb $0, $1 \0A\09 xaddb $0, $2", "r,r,*m"(i8 %a0, i8 %a1, i8 *%a2) nounwind
+  tail call void asm "xlat", ""() nounwind
   ret void
 }
-define void @test_xadd_16(i16 %a0, i16 %a1, i16 *%a2) optsize {
-; GENERIC-LABEL: test_xadd_16:
+
+define void @test_xor_8(i8 %a0, i8* %a1) optsize {
+; GENERIC-LABEL: test_xor_8:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    xaddw %di, %si # sched: [3:1.00]
-; GENERIC-NEXT:    xaddw %di, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    xorb $7, %al # sched: [1:0.33]
+; GENERIC-NEXT:    xorb $7, %dil # sched: [1:0.33]
+; GENERIC-NEXT:    xorb $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    xorb %dil, %dil # sched: [1:0.33]
+; GENERIC-NEXT:    xorb %dil, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    xorb (%rsi), %dil # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_xadd_16:
+; ATOM-LABEL: test_xor_8:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    xaddw %di, %si # sched: [2:1.00]
-; ATOM-NEXT:    xaddw %di, (%rdx) # sched: [3:1.50]
+; ATOM-NEXT:    xorb $7, %al # sched: [1:0.50]
+; ATOM-NEXT:    xorb $7, %dil # sched: [1:0.50]
+; ATOM-NEXT:    xorb $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    xorb %dil, %dil # sched: [1:0.50]
+; ATOM-NEXT:    xorb %dil, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    xorb (%rsi), %dil # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_xadd_16:
+; SLM-LABEL: test_xor_8:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    xaddw %di, %si # sched: [1:0.50]
-; SLM-NEXT:    xaddw %di, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    xorb $7, %al # sched: [1:0.50]
+; SLM-NEXT:    xorb $7, %dil # sched: [1:0.50]
+; SLM-NEXT:    xorb $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    xorb %dil, %dil # sched: [1:0.50]
+; SLM-NEXT:    xorb %dil, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    xorb (%rsi), %dil # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_xadd_16:
+; SANDY-LABEL: test_xor_8:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    xaddw %di, %si # sched: [3:1.00]
-; SANDY-NEXT:    xaddw %di, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    xorb $7, %al # sched: [1:0.33]
+; SANDY-NEXT:    xorb $7, %dil # sched: [1:0.33]
+; SANDY-NEXT:    xorb $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    xorb %dil, %dil # sched: [1:0.33]
+; SANDY-NEXT:    xorb %dil, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    xorb (%rsi), %dil # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_xadd_16:
+; HASWELL-LABEL: test_xor_8:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    xaddw %di, %si # sched: [3:0.75]
-; HASWELL-NEXT:    xaddw %di, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    xorb $7, %al # sched: [1:0.25]
+; HASWELL-NEXT:    xorb $7, %dil # sched: [1:0.25]
+; HASWELL-NEXT:    xorb $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    xorb %dil, %dil # sched: [1:0.25]
+; HASWELL-NEXT:    xorb %dil, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    xorb (%rsi), %dil # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_xadd_16:
+; BROADWELL-LABEL: test_xor_8:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    xaddw %di, %si # sched: [3:0.75]
-; BROADWELL-NEXT:    xaddw %di, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    xorb $7, %al # sched: [1:0.25]
+; BROADWELL-NEXT:    xorb $7, %dil # sched: [1:0.25]
+; BROADWELL-NEXT:    xorb $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    xorb %dil, %dil # sched: [1:0.25]
+; BROADWELL-NEXT:    xorb %dil, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    xorb (%rsi), %dil # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_xadd_16:
+; SKYLAKE-LABEL: test_xor_8:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    xaddw %di, %si # sched: [3:0.75]
-; SKYLAKE-NEXT:    xaddw %di, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    xorb $7, %al # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorb $7, %dil # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorb $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorb %dil, %dil # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorb %dil, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorb (%rsi), %dil # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_xadd_16:
+; SKX-LABEL: test_xor_8:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    xaddw %di, %si # sched: [3:0.75]
-; SKX-NEXT:    xaddw %di, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    xorb $7, %al # sched: [1:0.25]
+; SKX-NEXT:    xorb $7, %dil # sched: [1:0.25]
+; SKX-NEXT:    xorb $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    xorb %dil, %dil # sched: [1:0.25]
+; SKX-NEXT:    xorb %dil, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    xorb (%rsi), %dil # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_xadd_16:
+; BTVER2-LABEL: test_xor_8:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    xaddw %di, %si # sched: [1:0.50]
-; BTVER2-NEXT:    xaddw %di, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    xorb $7, %al # sched: [1:0.50]
+; BTVER2-NEXT:    xorb $7, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    xorb $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    xorb %dil, %dil # sched: [1:0.50]
+; BTVER2-NEXT:    xorb %dil, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    xorb (%rsi), %dil # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_xadd_16:
+; ZNVER1-LABEL: test_xor_8:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    xaddw %di, %si # sched: [1:0.25]
-; ZNVER1-NEXT:    xaddw %di, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    xorb $7, %al # sched: [1:0.25]
+; ZNVER1-NEXT:    xorb $7, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    xorb $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    xorb %dil, %dil # sched: [1:0.25]
+; ZNVER1-NEXT:    xorb %dil, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    xorb (%rsi), %dil # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "xaddw $0, $1 \0A\09 xaddw $0, $2", "r,r,*m"(i16 %a0, i16 %a1, i16 *%a2) nounwind
+  tail call void asm "xorb $2, %AL \0A\09 xorb $2, $0 \0A\09 xorb $2, $1 \0A\09 xorb $0, $0 \0A\09 xorb $0, $1 \0A\09 xorb $1, $0", "r,*m,i"(i8 %a0, i8* %a1, i8 7) nounwind
   ret void
 }
-define void @test_xadd_32(i32 %a0, i32 %a1, i32 *%a2) optsize {
-; GENERIC-LABEL: test_xadd_32:
+define void @test_xor_16(i16 %a0, i16* %a1) optsize {
+; GENERIC-LABEL: test_xor_16:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    xaddl %edi, %esi # sched: [3:1.00]
-; GENERIC-NEXT:    xaddl %edi, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    xorw $511, %ax # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    xorw $511, %di # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    xorw $7, %di # sched: [1:0.33]
+; GENERIC-NEXT:    xorw $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    xorw %di, %di # sched: [1:0.33]
+; GENERIC-NEXT:    xorw %di, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    xorw (%rsi), %di # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_xadd_32:
+; ATOM-LABEL: test_xor_16:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    xaddl %edi, %esi # sched: [2:1.00]
-; ATOM-NEXT:    xaddl %edi, (%rdx) # sched: [3:1.50]
+; ATOM-NEXT:    xorw $511, %ax # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    xorw $511, %di # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    xorw $7, %di # sched: [1:0.50]
+; ATOM-NEXT:    xorw $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    xorw %di, %di # sched: [1:0.50]
+; ATOM-NEXT:    xorw %di, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    xorw (%rsi), %di # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_xadd_32:
+; SLM-LABEL: test_xor_16:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    xaddl %edi, %esi # sched: [1:0.50]
-; SLM-NEXT:    xaddl %edi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    xorw $511, %ax # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    xorw $511, %di # imm = 0x1FF
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    xorw $7, %di # sched: [1:0.50]
+; SLM-NEXT:    xorw $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    xorw %di, %di # sched: [1:0.50]
+; SLM-NEXT:    xorw %di, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    xorw (%rsi), %di # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_xadd_32:
+; SANDY-LABEL: test_xor_16:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    xaddl %edi, %esi # sched: [3:1.00]
-; SANDY-NEXT:    xaddl %edi, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    xorw $511, %ax # imm = 0x1FF
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    xorw $511, %di # imm = 0x1FF
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    xorw $7, %di # sched: [1:0.33]
+; SANDY-NEXT:    xorw $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    xorw %di, %di # sched: [1:0.33]
+; SANDY-NEXT:    xorw %di, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    xorw (%rsi), %di # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_xadd_32:
+; HASWELL-LABEL: test_xor_16:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    xaddl %edi, %esi # sched: [3:0.75]
-; HASWELL-NEXT:    xaddl %edi, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    xorw $511, %ax # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    xorw $511, %di # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    xorw $7, %di # sched: [1:0.25]
+; HASWELL-NEXT:    xorw $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    xorw %di, %di # sched: [1:0.25]
+; HASWELL-NEXT:    xorw %di, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    xorw (%rsi), %di # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_xadd_32:
+; BROADWELL-LABEL: test_xor_16:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    xaddl %edi, %esi # sched: [3:0.75]
-; BROADWELL-NEXT:    xaddl %edi, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    xorw $511, %ax # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    xorw $511, %di # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    xorw $7, %di # sched: [1:0.25]
+; BROADWELL-NEXT:    xorw $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    xorw %di, %di # sched: [1:0.25]
+; BROADWELL-NEXT:    xorw %di, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    xorw (%rsi), %di # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_xadd_32:
+; SKYLAKE-LABEL: test_xor_16:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    xaddl %edi, %esi # sched: [3:0.75]
-; SKYLAKE-NEXT:    xaddl %edi, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    xorw $511, %ax # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorw $511, %di # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorw $7, %di # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorw $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorw %di, %di # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorw %di, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorw (%rsi), %di # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_xadd_32:
+; SKX-LABEL: test_xor_16:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    xaddl %edi, %esi # sched: [3:0.75]
-; SKX-NEXT:    xaddl %edi, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    xorw $511, %ax # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    xorw $511, %di # imm = 0x1FF
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    xorw $7, %di # sched: [1:0.25]
+; SKX-NEXT:    xorw $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    xorw %di, %di # sched: [1:0.25]
+; SKX-NEXT:    xorw %di, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    xorw (%rsi), %di # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_xadd_32:
+; BTVER2-LABEL: test_xor_16:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    xaddl %edi, %esi # sched: [1:0.50]
-; BTVER2-NEXT:    xaddl %edi, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    xorw $511, %ax # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    xorw $511, %di # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    xorw $7, %di # sched: [1:0.50]
+; BTVER2-NEXT:    xorw $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    xorw %di, %di # sched: [1:0.50]
+; BTVER2-NEXT:    xorw %di, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    xorw (%rsi), %di # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_xadd_32:
+; ZNVER1-LABEL: test_xor_16:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    xaddl %edi, %esi # sched: [1:0.25]
-; ZNVER1-NEXT:    xaddl %edi, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    xorw $511, %ax # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    xorw $511, %di # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    xorw $511, (%rsi) # imm = 0x1FF
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    xorw $7, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    xorw $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    xorw %di, %di # sched: [1:0.25]
+; ZNVER1-NEXT:    xorw %di, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    xorw (%rsi), %di # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "xaddl $0, $1 \0A\09 xaddl $0, $2", "r,r,*m"(i32 %a0, i32 %a1, i32 *%a2) nounwind
+  tail call void asm "xorw $2, %AX \0A\09 xorw $2, $0 \0A\09 xorw $2, $1 \0A\09 xorw $3, $0 \0A\09 xorw $3, $1 \0A\09 xorw $0, $0 \0A\09 xorw $0, $1 \0A\09 xorw $1, $0", "r,*m,i,i"(i16 %a0, i16* %a1, i16 511, i8 7) nounwind
   ret void
 }
-define void @test_xadd_64(i64 %a0, i64 %a1, i64 *%a2) optsize {
-; GENERIC-LABEL: test_xadd_64:
+define void @test_xor_32(i32 %a0, i32* %a1) optsize {
+; GENERIC-LABEL: test_xor_32:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    xaddq %rdi, %rsi # sched: [3:1.00]
-; GENERIC-NEXT:    xaddq %rdi, (%rdx) # sched: [8:1.00]
+; GENERIC-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    xorl $7, %edi # sched: [1:0.33]
+; GENERIC-NEXT:    xorl $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    xorl %edi, %edi # sched: [1:0.33]
+; GENERIC-NEXT:    xorl %edi, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    xorl (%rsi), %edi # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_xadd_64:
+; ATOM-LABEL: test_xor_32:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    xaddq %rdi, %rsi # sched: [2:1.00]
-; ATOM-NEXT:    xaddq %rdi, (%rdx) # sched: [3:1.50]
+; ATOM-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    xorl $7, %edi # sched: [1:0.50]
+; ATOM-NEXT:    xorl $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    xorl %edi, %edi # sched: [1:0.50]
+; ATOM-NEXT:    xorl %edi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    xorl (%rsi), %edi # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_xadd_64:
+; SLM-LABEL: test_xor_32:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    xaddq %rdi, %rsi # sched: [1:0.50]
-; SLM-NEXT:    xaddq %rdi, (%rdx) # sched: [4:2.00]
+; SLM-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    xorl $7, %edi # sched: [1:0.50]
+; SLM-NEXT:    xorl $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    xorl %edi, %edi # sched: [1:0.50]
+; SLM-NEXT:    xorl %edi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    xorl (%rsi), %edi # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_xadd_64:
+; SANDY-LABEL: test_xor_32:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    xaddq %rdi, %rsi # sched: [3:1.00]
-; SANDY-NEXT:    xaddq %rdi, (%rdx) # sched: [8:1.00]
+; SANDY-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    xorl $7, %edi # sched: [1:0.33]
+; SANDY-NEXT:    xorl $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    xorl %edi, %edi # sched: [1:0.33]
+; SANDY-NEXT:    xorl %edi, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    xorl (%rsi), %edi # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_xadd_64:
+; HASWELL-LABEL: test_xor_32:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    xaddq %rdi, %rsi # sched: [3:0.75]
-; HASWELL-NEXT:    xaddq %rdi, (%rdx) # sched: [8:1.00]
+; HASWELL-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    xorl $7, %edi # sched: [1:0.25]
+; HASWELL-NEXT:    xorl $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    xorl %edi, %edi # sched: [1:0.25]
+; HASWELL-NEXT:    xorl %edi, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    xorl (%rsi), %edi # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_xadd_64:
+; BROADWELL-LABEL: test_xor_32:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    xaddq %rdi, %rsi # sched: [3:0.75]
-; BROADWELL-NEXT:    xaddq %rdi, (%rdx) # sched: [7:1.00]
+; BROADWELL-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    xorl $7, %edi # sched: [1:0.25]
+; BROADWELL-NEXT:    xorl $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    xorl %edi, %edi # sched: [1:0.25]
+; BROADWELL-NEXT:    xorl %edi, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    xorl (%rsi), %edi # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_xadd_64:
+; SKYLAKE-LABEL: test_xor_32:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    xaddq %rdi, %rsi # sched: [3:0.75]
-; SKYLAKE-NEXT:    xaddq %rdi, (%rdx) # sched: [7:1.00]
+; SKYLAKE-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorl $7, %edi # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorl $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorl %edi, %edi # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorl %edi, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorl (%rsi), %edi # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_xadd_64:
+; SKX-LABEL: test_xor_32:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    xaddq %rdi, %rsi # sched: [3:0.75]
-; SKX-NEXT:    xaddq %rdi, (%rdx) # sched: [7:1.00]
+; SKX-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    xorl $7, %edi # sched: [1:0.25]
+; SKX-NEXT:    xorl $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    xorl %edi, %edi # sched: [1:0.25]
+; SKX-NEXT:    xorl %edi, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    xorl (%rsi), %edi # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_xadd_64:
+; BTVER2-LABEL: test_xor_32:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    xaddq %rdi, %rsi # sched: [1:0.50]
-; BTVER2-NEXT:    xaddq %rdi, (%rdx) # sched: [4:1.00]
+; BTVER2-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    xorl $7, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    xorl $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    xorl %edi, %edi # sched: [1:0.50]
+; BTVER2-NEXT:    xorl %edi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    xorl (%rsi), %edi # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_xadd_64:
+; ZNVER1-LABEL: test_xor_32:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    xaddq %rdi, %rsi # sched: [1:0.25]
-; ZNVER1-NEXT:    xaddq %rdi, (%rdx) # sched: [100:?]
+; ZNVER1-NEXT:    xorl $665536, %eax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    xorl $665536, %edi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    xorl $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    xorl $7, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    xorl $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    xorl %edi, %edi # sched: [1:0.25]
+; ZNVER1-NEXT:    xorl %edi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    xorl (%rsi), %edi # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "xaddq $0, $1 \0A\09 xaddq $0, $2", "r,r,*m"(i64 %a0, i64 %a1, i64 *%a2) nounwind
+  tail call void asm "xorl $2, %EAX \0A\09 xorl $2, $0 \0A\09 xorl $2, $1 \0A\09 xorl $3, $0 \0A\09 xorl $3, $1 \0A\09 xorl $0, $0 \0A\09 xorl $0, $1 \0A\09 xorl $1, $0", "r,*m,i,i"(i32 %a0, i32* %a1, i32 665536, i8 7) nounwind
   ret void
 }
-
-; TODO - test_xchg
-
-define void @test_xlat() optsize {
-; GENERIC-LABEL: test_xlat:
+define void @test_xor_64(i64 %a0, i64* %a1) optsize {
+; GENERIC-LABEL: test_xor_64:
 ; GENERIC:       # %bb.0:
 ; GENERIC-NEXT:    #APP
-; GENERIC-NEXT:    xlatb # sched: [4:0.50]
+; GENERIC-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [1:0.33]
+; GENERIC-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; GENERIC-NEXT:    # sched: [7:1.00]
+; GENERIC-NEXT:    xorq $7, %rdi # sched: [1:0.33]
+; GENERIC-NEXT:    xorq $7, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    xorq %rdi, %rdi # sched: [1:0.33]
+; GENERIC-NEXT:    xorq %rdi, (%rsi) # sched: [7:1.00]
+; GENERIC-NEXT:    xorq (%rsi), %rdi # sched: [6:0.50]
 ; GENERIC-NEXT:    #NO_APP
 ; GENERIC-NEXT:    retq # sched: [1:1.00]
 ;
-; ATOM-LABEL: test_xlat:
+; ATOM-LABEL: test_xor_64:
 ; ATOM:       # %bb.0:
 ; ATOM-NEXT:    #APP
-; ATOM-NEXT:    xlatb # sched: [6:3.00]
+; ATOM-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:0.50]
+; ATOM-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; ATOM-NEXT:    # sched: [1:1.00]
+; ATOM-NEXT:    xorq $7, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    xorq $7, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    xorq %rdi, %rdi # sched: [1:0.50]
+; ATOM-NEXT:    xorq %rdi, (%rsi) # sched: [1:1.00]
+; ATOM-NEXT:    xorq (%rsi), %rdi # sched: [1:1.00]
 ; ATOM-NEXT:    #NO_APP
 ; ATOM-NEXT:    retq # sched: [79:39.50]
 ;
-; SLM-LABEL: test_xlat:
+; SLM-LABEL: test_xor_64:
 ; SLM:       # %bb.0:
 ; SLM-NEXT:    #APP
-; SLM-NEXT:    xlatb # sched: [3:1.00]
+; SLM-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; SLM-NEXT:    # sched: [1:0.50]
+; SLM-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; SLM-NEXT:    # sched: [4:2.00]
+; SLM-NEXT:    xorq $7, %rdi # sched: [1:0.50]
+; SLM-NEXT:    xorq $7, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    xorq %rdi, %rdi # sched: [1:0.50]
+; SLM-NEXT:    xorq %rdi, (%rsi) # sched: [4:2.00]
+; SLM-NEXT:    xorq (%rsi), %rdi # sched: [4:1.00]
 ; SLM-NEXT:    #NO_APP
 ; SLM-NEXT:    retq # sched: [4:1.00]
 ;
-; SANDY-LABEL: test_xlat:
+; SANDY-LABEL: test_xor_64:
 ; SANDY:       # %bb.0:
 ; SANDY-NEXT:    #APP
-; SANDY-NEXT:    xlatb # sched: [4:0.50]
+; SANDY-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [1:0.33]
+; SANDY-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; SANDY-NEXT:    # sched: [7:1.00]
+; SANDY-NEXT:    xorq $7, %rdi # sched: [1:0.33]
+; SANDY-NEXT:    xorq $7, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    xorq %rdi, %rdi # sched: [1:0.33]
+; SANDY-NEXT:    xorq %rdi, (%rsi) # sched: [7:1.00]
+; SANDY-NEXT:    xorq (%rsi), %rdi # sched: [6:0.50]
 ; SANDY-NEXT:    #NO_APP
 ; SANDY-NEXT:    retq # sched: [1:1.00]
 ;
-; HASWELL-LABEL: test_xlat:
+; HASWELL-LABEL: test_xor_64:
 ; HASWELL:       # %bb.0:
 ; HASWELL-NEXT:    #APP
-; HASWELL-NEXT:    xlatb # sched: [7:?]
+; HASWELL-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [1:0.25]
+; HASWELL-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; HASWELL-NEXT:    # sched: [7:1.00]
+; HASWELL-NEXT:    xorq $7, %rdi # sched: [1:0.25]
+; HASWELL-NEXT:    xorq $7, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    xorq %rdi, %rdi # sched: [1:0.25]
+; HASWELL-NEXT:    xorq %rdi, (%rsi) # sched: [7:1.00]
+; HASWELL-NEXT:    xorq (%rsi), %rdi # sched: [6:0.50]
 ; HASWELL-NEXT:    #NO_APP
 ; HASWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; BROADWELL-LABEL: test_xlat:
+; BROADWELL-LABEL: test_xor_64:
 ; BROADWELL:       # %bb.0:
 ; BROADWELL-NEXT:    #APP
-; BROADWELL-NEXT:    xlatb # sched: [5:0.50]
+; BROADWELL-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [1:0.25]
+; BROADWELL-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; BROADWELL-NEXT:    # sched: [6:1.00]
+; BROADWELL-NEXT:    xorq $7, %rdi # sched: [1:0.25]
+; BROADWELL-NEXT:    xorq $7, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    xorq %rdi, %rdi # sched: [1:0.25]
+; BROADWELL-NEXT:    xorq %rdi, (%rsi) # sched: [6:1.00]
+; BROADWELL-NEXT:    xorq (%rsi), %rdi # sched: [6:0.50]
 ; BROADWELL-NEXT:    #NO_APP
 ; BROADWELL-NEXT:    retq # sched: [7:1.00]
 ;
-; SKYLAKE-LABEL: test_xlat:
+; SKYLAKE-LABEL: test_xor_64:
 ; SKYLAKE:       # %bb.0:
 ; SKYLAKE-NEXT:    #APP
-; SKYLAKE-NEXT:    xlatb # sched: [5:0.50]
+; SKYLAKE-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; SKYLAKE-NEXT:    # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorq $7, %rdi # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorq $7, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorq %rdi, %rdi # sched: [1:0.25]
+; SKYLAKE-NEXT:    xorq %rdi, (%rsi) # sched: [6:1.00]
+; SKYLAKE-NEXT:    xorq (%rsi), %rdi # sched: [6:0.50]
 ; SKYLAKE-NEXT:    #NO_APP
 ; SKYLAKE-NEXT:    retq # sched: [7:1.00]
 ;
-; SKX-LABEL: test_xlat:
+; SKX-LABEL: test_xor_64:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    #APP
-; SKX-NEXT:    xlatb # sched: [5:0.50]
+; SKX-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; SKX-NEXT:    # sched: [1:0.25]
+; SKX-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; SKX-NEXT:    # sched: [6:1.00]
+; SKX-NEXT:    xorq $7, %rdi # sched: [1:0.25]
+; SKX-NEXT:    xorq $7, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    xorq %rdi, %rdi # sched: [1:0.25]
+; SKX-NEXT:    xorq %rdi, (%rsi) # sched: [6:1.00]
+; SKX-NEXT:    xorq (%rsi), %rdi # sched: [6:0.50]
 ; SKX-NEXT:    #NO_APP
 ; SKX-NEXT:    retq # sched: [7:1.00]
 ;
-; BTVER2-LABEL: test_xlat:
+; BTVER2-LABEL: test_xor_64:
 ; BTVER2:       # %bb.0:
 ; BTVER2-NEXT:    #APP
-; BTVER2-NEXT:    xlatb # sched: [5:1.00]
+; BTVER2-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [1:0.50]
+; BTVER2-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; BTVER2-NEXT:    # sched: [4:1.00]
+; BTVER2-NEXT:    xorq $7, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    xorq $7, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    xorq %rdi, %rdi # sched: [1:0.50]
+; BTVER2-NEXT:    xorq %rdi, (%rsi) # sched: [4:1.00]
+; BTVER2-NEXT:    xorq (%rsi), %rdi # sched: [4:1.00]
 ; BTVER2-NEXT:    #NO_APP
 ; BTVER2-NEXT:    retq # sched: [4:1.00]
 ;
-; ZNVER1-LABEL: test_xlat:
+; ZNVER1-LABEL: test_xor_64:
 ; ZNVER1:       # %bb.0:
 ; ZNVER1-NEXT:    #APP
-; ZNVER1-NEXT:    xlatb # sched: [100:?]
+; ZNVER1-NEXT:    xorq $665536, %rax # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    xorq $665536, %rdi # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [1:0.25]
+; ZNVER1-NEXT:    xorq $665536, (%rsi) # imm = 0xA27C0
+; ZNVER1-NEXT:    # sched: [5:0.50]
+; ZNVER1-NEXT:    xorq $7, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    xorq $7, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    xorq %rdi, %rdi # sched: [1:0.25]
+; ZNVER1-NEXT:    xorq %rdi, (%rsi) # sched: [5:0.50]
+; ZNVER1-NEXT:    xorq (%rsi), %rdi # sched: [5:0.50]
 ; ZNVER1-NEXT:    #NO_APP
 ; ZNVER1-NEXT:    retq # sched: [1:0.50]
-  tail call void asm "xlat", ""() nounwind
+  tail call void asm "xorq $2, %RAX \0A\09 xorq $2, $0 \0A\09 xorq $2, $1 \0A\09 xorq $3, $0 \0A\09 xorq $3, $1 \0A\09 xorq $0, $0 \0A\09 xorq $0, $1 \0A\09 xorq $1, $0", "r,*m,i,i"(i64 %a0, i64* %a1, i32 665536, i8 7) nounwind
   ret void
 }
-
-; TODO - test_xor




More information about the llvm-commits mailing list