Index: lib/Target/X86/X86InstrSSE.td =================================================================== --- lib/Target/X86/X86InstrSSE.td +++ lib/Target/X86/X86InstrSSE.td @@ -846,10 +846,11 @@ multiclass sse12_cvt_s opc, RegisterClass SrcRC, RegisterClass DstRC, SDNode OpNode, X86MemOperand x86memop, PatFrag ld_frag, - string asm, X86FoldableSchedWrite sched> { + string asm, X86FoldableSchedWrite sched, + SchedRead Int2Fpu = ReadDefault> { def rr : SI, - Sched<[sched]>; + Sched<[sched, Int2Fpu]>; def rm : SI, Sched<[sched.Folded]>; @@ -876,7 +877,7 @@ let hasSideEffects = 0, Predicates = [UseAVX] in { def rr : SI, - Sched<[sched]>; + Sched<[sched, ReadDefault, ReadInt2Fpu]>; let mayLoad = 1 in def rm : SI, XD, REX_W; defm CVTSI2SS : sse12_cvt_s<0x2A, GR32, FR32, sint_to_fp, i32mem, loadi32, "cvtsi2ss{l}\t{$src, $dst|$dst, $src}", - WriteCvtI2SS>, XS; + WriteCvtI2SS, ReadInt2Fpu>, XS; defm CVTSI642SS : sse12_cvt_s<0x2A, GR64, FR32, sint_to_fp, i64mem, loadi64, "cvtsi2ss{q}\t{$src, $dst|$dst, $src}", - WriteCvtI2SS>, XS, REX_W; + WriteCvtI2SS, ReadInt2Fpu>, XS, REX_W; defm CVTSI2SD : sse12_cvt_s<0x2A, GR32, FR64, sint_to_fp, i32mem, loadi32, "cvtsi2sd{l}\t{$src, $dst|$dst, $src}", - WriteCvtI2SD>, XD; + WriteCvtI2SD, ReadInt2Fpu>, XD; defm CVTSI642SD : sse12_cvt_s<0x2A, GR64, FR64, sint_to_fp, i64mem, loadi64, "cvtsi2sd{q}\t{$src, $dst|$dst, $src}", - WriteCvtI2SD>, XD, REX_W; + WriteCvtI2SD, ReadInt2Fpu>, XD, REX_W; def : InstAlias<"cvttss2si{l}\t{$src, $dst|$dst, $src}", (CVTTSS2SIrr GR32:$dst, FR32:$src), 0, "att">; @@ -1031,7 +1032,7 @@ !if(Is2Addr, !strconcat(asm, "\t{$src2, $dst|$dst, $src2}"), !strconcat(asm, "\t{$src2, $src1, $dst|$dst, $src1, $src2}")), - []>, Sched<[sched]>; + []>, Sched<[sched, ReadDefault, ReadInt2Fpu]>; let mayLoad = 1 in def rm_Int : SI; defm : X86WriteResPairUnsupported; -// FIXME: f+3 ST, LD+STC latency -defm : JWriteResFpuPair; +defm : X86WriteRes; +defm : X86WriteRes; defm : JWriteResFpuPair; defm : JWriteResYMMPair; defm : X86WriteResPairUnsupported; -defm : JWriteResFpuPair; +defm : X86WriteRes; +defm : X86WriteRes; defm : JWriteResFpuPair; defm : JWriteResYMMPair; defm : X86WriteResPairUnsupported; Index: test/CodeGen/X86/sse-schedule.ll =================================================================== --- test/CodeGen/X86/sse-schedule.ll +++ test/CodeGen/X86/sse-schedule.ll @@ -1171,15 +1171,15 @@ ; ; BTVER2-SSE-LABEL: test_cvtsi2ss: ; BTVER2-SSE: # %bb.0: -; BTVER2-SSE-NEXT: cvtsi2ssl (%rsi), %xmm0 # sched: [14:1.00] -; BTVER2-SSE-NEXT: cvtsi2ssl %edi, %xmm1 # sched: [9:1.00] +; BTVER2-SSE-NEXT: cvtsi2ssl (%rsi), %xmm0 # sched: [9:1.00] +; BTVER2-SSE-NEXT: cvtsi2ssl %edi, %xmm1 # sched: [10:1.00] ; BTVER2-SSE-NEXT: addss %xmm1, %xmm0 # sched: [3:1.00] ; BTVER2-SSE-NEXT: retq # sched: [4:1.00] ; ; BTVER2-LABEL: test_cvtsi2ss: ; BTVER2: # %bb.0: -; BTVER2-NEXT: vcvtsi2ssl %edi, %xmm0, %xmm0 # sched: [9:1.00] -; BTVER2-NEXT: vcvtsi2ssl (%rsi), %xmm1, %xmm1 # sched: [14:1.00] +; BTVER2-NEXT: vcvtsi2ssl %edi, %xmm0, %xmm0 # sched: [10:1.00] +; BTVER2-NEXT: vcvtsi2ssl (%rsi), %xmm1, %xmm1 # sched: [9:1.00] ; BTVER2-NEXT: vaddss %xmm1, %xmm0, %xmm0 # sched: [3:1.00] ; BTVER2-NEXT: retq # sched: [4:1.00] ; @@ -1311,15 +1311,15 @@ ; ; BTVER2-SSE-LABEL: test_cvtsi2ssq: ; BTVER2-SSE: # %bb.0: -; BTVER2-SSE-NEXT: cvtsi2ssq (%rsi), %xmm0 # sched: [14:1.00] -; BTVER2-SSE-NEXT: cvtsi2ssq %rdi, %xmm1 # sched: [9:1.00] +; BTVER2-SSE-NEXT: cvtsi2ssq (%rsi), %xmm0 # sched: [9:1.00] +; BTVER2-SSE-NEXT: cvtsi2ssq %rdi, %xmm1 # sched: [10:1.00] ; BTVER2-SSE-NEXT: addss %xmm1, %xmm0 # sched: [3:1.00] ; BTVER2-SSE-NEXT: retq # sched: [4:1.00] ; ; BTVER2-LABEL: test_cvtsi2ssq: ; BTVER2: # %bb.0: -; BTVER2-NEXT: vcvtsi2ssq %rdi, %xmm0, %xmm0 # sched: [9:1.00] -; BTVER2-NEXT: vcvtsi2ssq (%rsi), %xmm1, %xmm1 # sched: [14:1.00] +; BTVER2-NEXT: vcvtsi2ssq %rdi, %xmm0, %xmm0 # sched: [10:1.00] +; BTVER2-NEXT: vcvtsi2ssq (%rsi), %xmm1, %xmm1 # sched: [9:1.00] ; BTVER2-NEXT: vaddss %xmm1, %xmm0, %xmm0 # sched: [3:1.00] ; BTVER2-NEXT: retq # sched: [4:1.00] ; Index: test/CodeGen/X86/sse2-schedule.ll =================================================================== --- test/CodeGen/X86/sse2-schedule.ll +++ test/CodeGen/X86/sse2-schedule.ll @@ -2608,15 +2608,15 @@ ; ; BTVER2-SSE-LABEL: test_cvtsi2sd: ; BTVER2-SSE: # %bb.0: -; BTVER2-SSE-NEXT: cvtsi2sdl (%rsi), %xmm0 # sched: [14:1.00] -; BTVER2-SSE-NEXT: cvtsi2sdl %edi, %xmm1 # sched: [9:1.00] +; BTVER2-SSE-NEXT: cvtsi2sdl (%rsi), %xmm0 # sched: [9:1.00] +; BTVER2-SSE-NEXT: cvtsi2sdl %edi, %xmm1 # sched: [10:1.00] ; BTVER2-SSE-NEXT: addsd %xmm1, %xmm0 # sched: [3:1.00] ; BTVER2-SSE-NEXT: retq # sched: [4:1.00] ; ; BTVER2-LABEL: test_cvtsi2sd: ; BTVER2: # %bb.0: -; BTVER2-NEXT: vcvtsi2sdl %edi, %xmm0, %xmm0 # sched: [9:1.00] -; BTVER2-NEXT: vcvtsi2sdl (%rsi), %xmm1, %xmm1 # sched: [14:1.00] +; BTVER2-NEXT: vcvtsi2sdl %edi, %xmm0, %xmm0 # sched: [10:1.00] +; BTVER2-NEXT: vcvtsi2sdl (%rsi), %xmm1, %xmm1 # sched: [9:1.00] ; BTVER2-NEXT: vaddsd %xmm1, %xmm0, %xmm0 # sched: [3:1.00] ; BTVER2-NEXT: retq # sched: [4:1.00] ; @@ -2748,15 +2748,15 @@ ; ; BTVER2-SSE-LABEL: test_cvtsi2sdq: ; BTVER2-SSE: # %bb.0: -; BTVER2-SSE-NEXT: cvtsi2sdq (%rsi), %xmm0 # sched: [14:1.00] -; BTVER2-SSE-NEXT: cvtsi2sdq %rdi, %xmm1 # sched: [9:1.00] +; BTVER2-SSE-NEXT: cvtsi2sdq (%rsi), %xmm0 # sched: [9:1.00] +; BTVER2-SSE-NEXT: cvtsi2sdq %rdi, %xmm1 # sched: [10:1.00] ; BTVER2-SSE-NEXT: addsd %xmm1, %xmm0 # sched: [3:1.00] ; BTVER2-SSE-NEXT: retq # sched: [4:1.00] ; ; BTVER2-LABEL: test_cvtsi2sdq: ; BTVER2: # %bb.0: -; BTVER2-NEXT: vcvtsi2sdq %rdi, %xmm0, %xmm0 # sched: [9:1.00] -; BTVER2-NEXT: vcvtsi2sdq (%rsi), %xmm1, %xmm1 # sched: [14:1.00] +; BTVER2-NEXT: vcvtsi2sdq %rdi, %xmm0, %xmm0 # sched: [10:1.00] +; BTVER2-NEXT: vcvtsi2sdq (%rsi), %xmm1, %xmm1 # sched: [9:1.00] ; BTVER2-NEXT: vaddsd %xmm1, %xmm0, %xmm0 # sched: [3:1.00] ; BTVER2-NEXT: retq # sched: [4:1.00] ; Index: test/tools/llvm-mca/X86/BtVer2/int-to-fpu-forwarding-2.s =================================================================== --- test/tools/llvm-mca/X86/BtVer2/int-to-fpu-forwarding-2.s +++ test/tools/llvm-mca/X86/BtVer2/int-to-fpu-forwarding-2.s @@ -1,7 +1,8 @@ # NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py # RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=500 < %s | FileCheck %s -# Throughput for all the code snippet below should tend to 1.00 IPC. +# Throughput for the AVX code snippets below should tend to 0.25 IPC. +# Throughput for the SSE code snippets below should tend to 1.00 IPC. # LLVM-MCA-BEGIN vcvtsi2ss %ecx, %xmm0, %xmm0 @@ -31,12 +32,12 @@ # CHECK: Iterations: 500 # CHECK-NEXT: Instructions: 500 -# CHECK-NEXT: Total Cycles: 4503 +# CHECK-NEXT: Total Cycles: 2003 # CHECK-NEXT: Total uOps: 1000 # CHECK: Dispatch Width: 2 -# CHECK-NEXT: uOps Per Cycle: 0.22 -# CHECK-NEXT: IPC: 0.11 +# CHECK-NEXT: uOps Per Cycle: 0.50 +# CHECK-NEXT: IPC: 0.25 # CHECK-NEXT: Block RThroughput: 1.0 # CHECK: Instruction Info: @@ -48,7 +49,7 @@ # CHECK-NEXT: [6]: HasSideEffects (U) # CHECK: [1] [2] [3] [4] [5] [6] Instructions: -# CHECK-NEXT: 2 9 1.00 vcvtsi2ssl %ecx, %xmm0, %xmm0 +# CHECK-NEXT: 2 10 1.00 vcvtsi2ssl %ecx, %xmm0, %xmm0 # CHECK: Resources: # CHECK-NEXT: [0] - JALU0 @@ -78,12 +79,12 @@ # CHECK: Iterations: 500 # CHECK-NEXT: Instructions: 500 -# CHECK-NEXT: Total Cycles: 4503 +# CHECK-NEXT: Total Cycles: 2003 # CHECK-NEXT: Total uOps: 1000 # CHECK: Dispatch Width: 2 -# CHECK-NEXT: uOps Per Cycle: 0.22 -# CHECK-NEXT: IPC: 0.11 +# CHECK-NEXT: uOps Per Cycle: 0.50 +# CHECK-NEXT: IPC: 0.25 # CHECK-NEXT: Block RThroughput: 1.0 # CHECK: Instruction Info: @@ -95,7 +96,7 @@ # CHECK-NEXT: [6]: HasSideEffects (U) # CHECK: [1] [2] [3] [4] [5] [6] Instructions: -# CHECK-NEXT: 2 9 1.00 vcvtsi2sdl %ecx, %xmm0, %xmm0 +# CHECK-NEXT: 2 10 1.00 vcvtsi2sdl %ecx, %xmm0, %xmm0 # CHECK: Resources: # CHECK-NEXT: [0] - JALU0 @@ -125,12 +126,12 @@ # CHECK: Iterations: 500 # CHECK-NEXT: Instructions: 500 -# CHECK-NEXT: Total Cycles: 511 +# CHECK-NEXT: Total Cycles: 506 # CHECK-NEXT: Total uOps: 1000 # CHECK: Dispatch Width: 2 -# CHECK-NEXT: uOps Per Cycle: 1.96 -# CHECK-NEXT: IPC: 0.98 +# CHECK-NEXT: uOps Per Cycle: 1.98 +# CHECK-NEXT: IPC: 0.99 # CHECK-NEXT: Block RThroughput: 1.0 # CHECK: Instruction Info: @@ -142,7 +143,7 @@ # CHECK-NEXT: [6]: HasSideEffects (U) # CHECK: [1] [2] [3] [4] [5] [6] Instructions: -# CHECK-NEXT: 2 9 1.00 cvtsi2ssl %ecx, %xmm0 +# CHECK-NEXT: 2 10 1.00 cvtsi2ssl %ecx, %xmm0 # CHECK: Resources: # CHECK-NEXT: [0] - JALU0 @@ -172,12 +173,12 @@ # CHECK: Iterations: 500 # CHECK-NEXT: Instructions: 500 -# CHECK-NEXT: Total Cycles: 511 +# CHECK-NEXT: Total Cycles: 506 # CHECK-NEXT: Total uOps: 1000 # CHECK: Dispatch Width: 2 -# CHECK-NEXT: uOps Per Cycle: 1.96 -# CHECK-NEXT: IPC: 0.98 +# CHECK-NEXT: uOps Per Cycle: 1.98 +# CHECK-NEXT: IPC: 0.99 # CHECK-NEXT: Block RThroughput: 1.0 # CHECK: Instruction Info: @@ -189,7 +190,7 @@ # CHECK-NEXT: [6]: HasSideEffects (U) # CHECK: [1] [2] [3] [4] [5] [6] Instructions: -# CHECK-NEXT: 2 9 1.00 cvtsi2sdl %ecx, %xmm0 +# CHECK-NEXT: 2 10 1.00 cvtsi2sdl %ecx, %xmm0 # CHECK: Resources: # CHECK-NEXT: [0] - JALU0 Index: test/tools/llvm-mca/X86/BtVer2/resources-avx1.s =================================================================== --- test/tools/llvm-mca/X86/BtVer2/resources-avx1.s +++ test/tools/llvm-mca/X86/BtVer2/resources-avx1.s @@ -1144,14 +1144,14 @@ # CHECK-NEXT: 2 12 1.00 * vcvtsd2si (%rax), %rcx # CHECK-NEXT: 2 7 2.00 vcvtsd2ss %xmm0, %xmm1, %xmm2 # CHECK-NEXT: 2 12 2.00 * vcvtsd2ss (%rax), %xmm1, %xmm2 -# CHECK-NEXT: 2 9 1.00 vcvtsi2sdl %ecx, %xmm0, %xmm2 -# CHECK-NEXT: 2 9 1.00 vcvtsi2sdq %rcx, %xmm0, %xmm2 -# CHECK-NEXT: 2 14 1.00 * vcvtsi2sdl (%rax), %xmm0, %xmm2 -# CHECK-NEXT: 2 14 1.00 * vcvtsi2sdq (%rax), %xmm0, %xmm2 -# CHECK-NEXT: 2 9 1.00 vcvtsi2ssl %ecx, %xmm0, %xmm2 -# CHECK-NEXT: 2 9 1.00 vcvtsi2ssq %rcx, %xmm0, %xmm2 -# CHECK-NEXT: 2 14 1.00 * vcvtsi2ssl (%rax), %xmm0, %xmm2 -# CHECK-NEXT: 2 14 1.00 * vcvtsi2ssq (%rax), %xmm0, %xmm2 +# CHECK-NEXT: 2 10 1.00 vcvtsi2sdl %ecx, %xmm0, %xmm2 +# CHECK-NEXT: 2 10 1.00 vcvtsi2sdq %rcx, %xmm0, %xmm2 +# CHECK-NEXT: 1 9 1.00 * vcvtsi2sdl (%rax), %xmm0, %xmm2 +# CHECK-NEXT: 1 9 1.00 * vcvtsi2sdq (%rax), %xmm0, %xmm2 +# CHECK-NEXT: 2 10 1.00 vcvtsi2ssl %ecx, %xmm0, %xmm2 +# CHECK-NEXT: 2 10 1.00 vcvtsi2ssq %rcx, %xmm0, %xmm2 +# CHECK-NEXT: 1 9 1.00 * vcvtsi2ssl (%rax), %xmm0, %xmm2 +# CHECK-NEXT: 1 9 1.00 * vcvtsi2ssq (%rax), %xmm0, %xmm2 # CHECK-NEXT: 2 7 2.00 vcvtss2sd %xmm0, %xmm1, %xmm2 # CHECK-NEXT: 2 12 2.00 * vcvtss2sd (%rax), %xmm1, %xmm2 # CHECK-NEXT: 2 7 1.00 vcvtss2si %xmm0, %ecx Index: test/tools/llvm-mca/X86/BtVer2/resources-sse1.s =================================================================== --- test/tools/llvm-mca/X86/BtVer2/resources-sse1.s +++ test/tools/llvm-mca/X86/BtVer2/resources-sse1.s @@ -212,10 +212,10 @@ # CHECK-NEXT: 1 8 1.00 * cvtpi2ps (%rax), %xmm2 # CHECK-NEXT: 1 3 1.00 cvtps2pi %xmm0, %mm2 # CHECK-NEXT: 1 8 1.00 * cvtps2pi (%rax), %mm2 -# CHECK-NEXT: 2 9 1.00 cvtsi2ssl %ecx, %xmm2 -# CHECK-NEXT: 2 9 1.00 cvtsi2ssq %rcx, %xmm2 -# CHECK-NEXT: 2 14 1.00 * cvtsi2ssl (%rax), %xmm2 -# CHECK-NEXT: 2 14 1.00 * cvtsi2ssl (%rax), %xmm2 +# CHECK-NEXT: 2 10 1.00 cvtsi2ssl %ecx, %xmm2 +# CHECK-NEXT: 2 10 1.00 cvtsi2ssq %rcx, %xmm2 +# CHECK-NEXT: 1 9 1.00 * cvtsi2ssl (%rax), %xmm2 +# CHECK-NEXT: 1 9 1.00 * cvtsi2ssl (%rax), %xmm2 # CHECK-NEXT: 2 7 1.00 cvtss2si %xmm0, %ecx # CHECK-NEXT: 2 7 1.00 cvtss2si %xmm0, %rcx # CHECK-NEXT: 2 12 1.00 * cvtss2si (%rax), %ecx Index: test/tools/llvm-mca/X86/BtVer2/resources-sse2.s =================================================================== --- test/tools/llvm-mca/X86/BtVer2/resources-sse2.s +++ test/tools/llvm-mca/X86/BtVer2/resources-sse2.s @@ -444,10 +444,10 @@ # CHECK-NEXT: 2 12 1.00 * cvtsd2si (%rax), %rcx # CHECK-NEXT: 2 7 2.00 cvtsd2ss %xmm0, %xmm2 # CHECK-NEXT: 2 12 2.00 * cvtsd2ss (%rax), %xmm2 -# CHECK-NEXT: 2 9 1.00 cvtsi2sdl %ecx, %xmm2 -# CHECK-NEXT: 2 9 1.00 cvtsi2sdq %rcx, %xmm2 -# CHECK-NEXT: 2 14 1.00 * cvtsi2sdl (%rax), %xmm2 -# CHECK-NEXT: 2 14 1.00 * cvtsi2sdl (%rax), %xmm2 +# CHECK-NEXT: 2 10 1.00 cvtsi2sdl %ecx, %xmm2 +# CHECK-NEXT: 2 10 1.00 cvtsi2sdq %rcx, %xmm2 +# CHECK-NEXT: 1 9 1.00 * cvtsi2sdl (%rax), %xmm2 +# CHECK-NEXT: 1 9 1.00 * cvtsi2sdl (%rax), %xmm2 # CHECK-NEXT: 2 7 2.00 cvtss2sd %xmm0, %xmm2 # CHECK-NEXT: 2 12 2.00 * cvtss2sd (%rax), %xmm2 # CHECK-NEXT: 1 3 1.00 cvttpd2dq %xmm0, %xmm2