1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X86 3 ; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=haswell| FileCheck %s --check-prefix=X64-HSW 4 ; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=btver2| FileCheck %s --check-prefix=X64-JAG 5 ; RUN: llc < %s -mtriple=i686-unknown -mul-constant-optimization=false | FileCheck %s --check-prefix=X86-NOOPT 6 ; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=haswell| FileCheck %s --check-prefix=HSW-NOOPT 7 ; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=btver2| FileCheck %s --check-prefix=JAG-NOOPT 8 ; RUN: llc < %s -mtriple=x86_64-unknown -print-schedule=true -mcpu=slm| FileCheck %s --check-prefix=X64-SLM 9 ; RUN: llc < %s -mtriple=x86_64-unknown -mul-constant-optimization=false -print-schedule=true -mcpu=slm| FileCheck %s --check-prefix=SLM-NOOPT 10 11 define i32 @test_mul_by_1(i32 %x) { 12 ; X86-LABEL: test_mul_by_1: 13 ; X86: # %bb.0: 14 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 15 ; X86-NEXT: retl 16 ; 17 ; X64-HSW-LABEL: test_mul_by_1: 18 ; X64-HSW: # %bb.0: 19 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 20 ; X64-HSW-NEXT: retq # sched: [7:1.00] 21 ; 22 ; X64-JAG-LABEL: test_mul_by_1: 23 ; X64-JAG: # %bb.0: 24 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 25 ; X64-JAG-NEXT: retq # sched: [4:1.00] 26 ; 27 ; X86-NOOPT-LABEL: test_mul_by_1: 28 ; X86-NOOPT: # %bb.0: 29 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 30 ; X86-NOOPT-NEXT: retl 31 ; 32 ; HSW-NOOPT-LABEL: test_mul_by_1: 33 ; HSW-NOOPT: # %bb.0: 34 ; HSW-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.25] 35 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 36 ; 37 ; JAG-NOOPT-LABEL: test_mul_by_1: 38 ; JAG-NOOPT: # %bb.0: 39 ; JAG-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.50] 40 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 41 ; 42 ; X64-SLM-LABEL: test_mul_by_1: 43 ; X64-SLM: # %bb.0: 44 ; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50] 45 ; X64-SLM-NEXT: retq # sched: [4:1.00] 46 ; 47 ; SLM-NOOPT-LABEL: test_mul_by_1: 48 ; SLM-NOOPT: # %bb.0: 49 ; SLM-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.50] 50 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 51 %mul = mul nsw i32 %x, 1 52 ret i32 %mul 53 } 54 55 define i32 @test_mul_by_2(i32 %x) { 56 ; X86-LABEL: test_mul_by_2: 57 ; X86: # %bb.0: 58 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 59 ; X86-NEXT: addl %eax, %eax 60 ; X86-NEXT: retl 61 ; 62 ; X64-HSW-LABEL: test_mul_by_2: 63 ; X64-HSW: # %bb.0: 64 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 65 ; X64-HSW-NEXT: leal (%rdi,%rdi), %eax # sched: [1:0.50] 66 ; X64-HSW-NEXT: retq # sched: [7:1.00] 67 ; 68 ; X64-JAG-LABEL: test_mul_by_2: 69 ; X64-JAG: # %bb.0: 70 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 71 ; X64-JAG-NEXT: leal (%rdi,%rdi), %eax # sched: [1:0.50] 72 ; X64-JAG-NEXT: retq # sched: [4:1.00] 73 ; 74 ; X86-NOOPT-LABEL: test_mul_by_2: 75 ; X86-NOOPT: # %bb.0: 76 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 77 ; X86-NOOPT-NEXT: addl %eax, %eax 78 ; X86-NOOPT-NEXT: retl 79 ; 80 ; HSW-NOOPT-LABEL: test_mul_by_2: 81 ; HSW-NOOPT: # %bb.0: 82 ; HSW-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 83 ; HSW-NOOPT-NEXT: leal (%rdi,%rdi), %eax # sched: [1:0.50] 84 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 85 ; 86 ; JAG-NOOPT-LABEL: test_mul_by_2: 87 ; JAG-NOOPT: # %bb.0: 88 ; JAG-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 89 ; JAG-NOOPT-NEXT: leal (%rdi,%rdi), %eax # sched: [1:0.50] 90 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 91 ; 92 ; X64-SLM-LABEL: test_mul_by_2: 93 ; X64-SLM: # %bb.0: 94 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 95 ; X64-SLM-NEXT: leal (%rdi,%rdi), %eax # sched: [1:1.00] 96 ; X64-SLM-NEXT: retq # sched: [4:1.00] 97 ; 98 ; SLM-NOOPT-LABEL: test_mul_by_2: 99 ; SLM-NOOPT: # %bb.0: 100 ; SLM-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 101 ; SLM-NOOPT-NEXT: leal (%rdi,%rdi), %eax # sched: [1:1.00] 102 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 103 %mul = mul nsw i32 %x, 2 104 ret i32 %mul 105 } 106 107 define i32 @test_mul_by_3(i32 %x) { 108 ; X86-LABEL: test_mul_by_3: 109 ; X86: # %bb.0: 110 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 111 ; X86-NEXT: leal (%eax,%eax,2), %eax 112 ; X86-NEXT: retl 113 ; 114 ; X64-HSW-LABEL: test_mul_by_3: 115 ; X64-HSW: # %bb.0: 116 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 117 ; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50] 118 ; X64-HSW-NEXT: retq # sched: [7:1.00] 119 ; 120 ; X64-JAG-LABEL: test_mul_by_3: 121 ; X64-JAG: # %bb.0: 122 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 123 ; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [2:1.00] 124 ; X64-JAG-NEXT: retq # sched: [4:1.00] 125 ; 126 ; X86-NOOPT-LABEL: test_mul_by_3: 127 ; X86-NOOPT: # %bb.0: 128 ; X86-NOOPT-NEXT: imull $3, {{[0-9]+}}(%esp), %eax 129 ; X86-NOOPT-NEXT: retl 130 ; 131 ; HSW-NOOPT-LABEL: test_mul_by_3: 132 ; HSW-NOOPT: # %bb.0: 133 ; HSW-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 134 ; HSW-NOOPT-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50] 135 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 136 ; 137 ; JAG-NOOPT-LABEL: test_mul_by_3: 138 ; JAG-NOOPT: # %bb.0: 139 ; JAG-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 140 ; JAG-NOOPT-NEXT: leal (%rdi,%rdi,2), %eax # sched: [2:1.00] 141 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 142 ; 143 ; X64-SLM-LABEL: test_mul_by_3: 144 ; X64-SLM: # %bb.0: 145 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 146 ; X64-SLM-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00] 147 ; X64-SLM-NEXT: retq # sched: [4:1.00] 148 ; 149 ; SLM-NOOPT-LABEL: test_mul_by_3: 150 ; SLM-NOOPT: # %bb.0: 151 ; SLM-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 152 ; SLM-NOOPT-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00] 153 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 154 %mul = mul nsw i32 %x, 3 155 ret i32 %mul 156 } 157 158 define i32 @test_mul_by_4(i32 %x) { 159 ; X86-LABEL: test_mul_by_4: 160 ; X86: # %bb.0: 161 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 162 ; X86-NEXT: shll $2, %eax 163 ; X86-NEXT: retl 164 ; 165 ; X64-HSW-LABEL: test_mul_by_4: 166 ; X64-HSW: # %bb.0: 167 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 168 ; X64-HSW-NEXT: leal (,%rdi,4), %eax # sched: [1:0.50] 169 ; X64-HSW-NEXT: retq # sched: [7:1.00] 170 ; 171 ; X64-JAG-LABEL: test_mul_by_4: 172 ; X64-JAG: # %bb.0: 173 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 174 ; X64-JAG-NEXT: leal (,%rdi,4), %eax # sched: [2:1.00] 175 ; X64-JAG-NEXT: retq # sched: [4:1.00] 176 ; 177 ; X86-NOOPT-LABEL: test_mul_by_4: 178 ; X86-NOOPT: # %bb.0: 179 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 180 ; X86-NOOPT-NEXT: shll $2, %eax 181 ; X86-NOOPT-NEXT: retl 182 ; 183 ; HSW-NOOPT-LABEL: test_mul_by_4: 184 ; HSW-NOOPT: # %bb.0: 185 ; HSW-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 186 ; HSW-NOOPT-NEXT: leal (,%rdi,4), %eax # sched: [1:0.50] 187 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 188 ; 189 ; JAG-NOOPT-LABEL: test_mul_by_4: 190 ; JAG-NOOPT: # %bb.0: 191 ; JAG-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 192 ; JAG-NOOPT-NEXT: leal (,%rdi,4), %eax # sched: [2:1.00] 193 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 194 ; 195 ; X64-SLM-LABEL: test_mul_by_4: 196 ; X64-SLM: # %bb.0: 197 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 198 ; X64-SLM-NEXT: leal (,%rdi,4), %eax # sched: [1:1.00] 199 ; X64-SLM-NEXT: retq # sched: [4:1.00] 200 ; 201 ; SLM-NOOPT-LABEL: test_mul_by_4: 202 ; SLM-NOOPT: # %bb.0: 203 ; SLM-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 204 ; SLM-NOOPT-NEXT: leal (,%rdi,4), %eax # sched: [1:1.00] 205 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 206 %mul = mul nsw i32 %x, 4 207 ret i32 %mul 208 } 209 210 define i32 @test_mul_by_5(i32 %x) { 211 ; X86-LABEL: test_mul_by_5: 212 ; X86: # %bb.0: 213 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 214 ; X86-NEXT: leal (%eax,%eax,4), %eax 215 ; X86-NEXT: retl 216 ; 217 ; X64-HSW-LABEL: test_mul_by_5: 218 ; X64-HSW: # %bb.0: 219 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 220 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 221 ; X64-HSW-NEXT: retq # sched: [7:1.00] 222 ; 223 ; X64-JAG-LABEL: test_mul_by_5: 224 ; X64-JAG: # %bb.0: 225 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 226 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 227 ; X64-JAG-NEXT: retq # sched: [4:1.00] 228 ; 229 ; X86-NOOPT-LABEL: test_mul_by_5: 230 ; X86-NOOPT: # %bb.0: 231 ; X86-NOOPT-NEXT: imull $5, {{[0-9]+}}(%esp), %eax 232 ; X86-NOOPT-NEXT: retl 233 ; 234 ; HSW-NOOPT-LABEL: test_mul_by_5: 235 ; HSW-NOOPT: # %bb.0: 236 ; HSW-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 237 ; HSW-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 238 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 239 ; 240 ; JAG-NOOPT-LABEL: test_mul_by_5: 241 ; JAG-NOOPT: # %bb.0: 242 ; JAG-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 243 ; JAG-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 244 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 245 ; 246 ; X64-SLM-LABEL: test_mul_by_5: 247 ; X64-SLM: # %bb.0: 248 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 249 ; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00] 250 ; X64-SLM-NEXT: retq # sched: [4:1.00] 251 ; 252 ; SLM-NOOPT-LABEL: test_mul_by_5: 253 ; SLM-NOOPT: # %bb.0: 254 ; SLM-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 255 ; SLM-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00] 256 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 257 %mul = mul nsw i32 %x, 5 258 ret i32 %mul 259 } 260 261 define i32 @test_mul_by_6(i32 %x) { 262 ; X86-LABEL: test_mul_by_6: 263 ; X86: # %bb.0: 264 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 265 ; X86-NEXT: addl %eax, %eax 266 ; X86-NEXT: leal (%eax,%eax,2), %eax 267 ; X86-NEXT: retl 268 ; 269 ; X64-HSW-LABEL: test_mul_by_6: 270 ; X64-HSW: # %bb.0: 271 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 272 ; X64-HSW-NEXT: addl %edi, %edi # sched: [1:0.25] 273 ; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50] 274 ; X64-HSW-NEXT: retq # sched: [7:1.00] 275 ; 276 ; X64-JAG-LABEL: test_mul_by_6: 277 ; X64-JAG: # %bb.0: 278 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 279 ; X64-JAG-NEXT: addl %edi, %edi # sched: [1:0.50] 280 ; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [2:1.00] 281 ; X64-JAG-NEXT: retq # sched: [4:1.00] 282 ; 283 ; X86-NOOPT-LABEL: test_mul_by_6: 284 ; X86-NOOPT: # %bb.0: 285 ; X86-NOOPT-NEXT: imull $6, {{[0-9]+}}(%esp), %eax 286 ; X86-NOOPT-NEXT: retl 287 ; 288 ; HSW-NOOPT-LABEL: test_mul_by_6: 289 ; HSW-NOOPT: # %bb.0: 290 ; HSW-NOOPT-NEXT: imull $6, %edi, %eax # sched: [3:1.00] 291 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 292 ; 293 ; JAG-NOOPT-LABEL: test_mul_by_6: 294 ; JAG-NOOPT: # %bb.0: 295 ; JAG-NOOPT-NEXT: imull $6, %edi, %eax # sched: [3:1.00] 296 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 297 ; 298 ; X64-SLM-LABEL: test_mul_by_6: 299 ; X64-SLM: # %bb.0: 300 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 301 ; X64-SLM-NEXT: addl %edi, %edi # sched: [1:0.50] 302 ; X64-SLM-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00] 303 ; X64-SLM-NEXT: retq # sched: [4:1.00] 304 ; 305 ; SLM-NOOPT-LABEL: test_mul_by_6: 306 ; SLM-NOOPT: # %bb.0: 307 ; SLM-NOOPT-NEXT: imull $6, %edi, %eax # sched: [3:1.00] 308 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 309 %mul = mul nsw i32 %x, 6 310 ret i32 %mul 311 } 312 313 define i32 @test_mul_by_7(i32 %x) { 314 ; X86-LABEL: test_mul_by_7: 315 ; X86: # %bb.0: 316 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 317 ; X86-NEXT: leal (,%ecx,8), %eax 318 ; X86-NEXT: subl %ecx, %eax 319 ; X86-NEXT: retl 320 ; 321 ; X64-HSW-LABEL: test_mul_by_7: 322 ; X64-HSW: # %bb.0: 323 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 324 ; X64-HSW-NEXT: leal (,%rdi,8), %eax # sched: [1:0.50] 325 ; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25] 326 ; X64-HSW-NEXT: retq # sched: [7:1.00] 327 ; 328 ; X64-JAG-LABEL: test_mul_by_7: 329 ; X64-JAG: # %bb.0: 330 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 331 ; X64-JAG-NEXT: leal (,%rdi,8), %eax # sched: [2:1.00] 332 ; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50] 333 ; X64-JAG-NEXT: retq # sched: [4:1.00] 334 ; 335 ; X86-NOOPT-LABEL: test_mul_by_7: 336 ; X86-NOOPT: # %bb.0: 337 ; X86-NOOPT-NEXT: imull $7, {{[0-9]+}}(%esp), %eax 338 ; X86-NOOPT-NEXT: retl 339 ; 340 ; HSW-NOOPT-LABEL: test_mul_by_7: 341 ; HSW-NOOPT: # %bb.0: 342 ; HSW-NOOPT-NEXT: imull $7, %edi, %eax # sched: [3:1.00] 343 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 344 ; 345 ; JAG-NOOPT-LABEL: test_mul_by_7: 346 ; JAG-NOOPT: # %bb.0: 347 ; JAG-NOOPT-NEXT: imull $7, %edi, %eax # sched: [3:1.00] 348 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 349 ; 350 ; X64-SLM-LABEL: test_mul_by_7: 351 ; X64-SLM: # %bb.0: 352 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 353 ; X64-SLM-NEXT: leal (,%rdi,8), %eax # sched: [1:1.00] 354 ; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50] 355 ; X64-SLM-NEXT: retq # sched: [4:1.00] 356 ; 357 ; SLM-NOOPT-LABEL: test_mul_by_7: 358 ; SLM-NOOPT: # %bb.0: 359 ; SLM-NOOPT-NEXT: imull $7, %edi, %eax # sched: [3:1.00] 360 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 361 %mul = mul nsw i32 %x, 7 362 ret i32 %mul 363 } 364 365 define i32 @test_mul_by_8(i32 %x) { 366 ; X86-LABEL: test_mul_by_8: 367 ; X86: # %bb.0: 368 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 369 ; X86-NEXT: shll $3, %eax 370 ; X86-NEXT: retl 371 ; 372 ; X64-HSW-LABEL: test_mul_by_8: 373 ; X64-HSW: # %bb.0: 374 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 375 ; X64-HSW-NEXT: leal (,%rdi,8), %eax # sched: [1:0.50] 376 ; X64-HSW-NEXT: retq # sched: [7:1.00] 377 ; 378 ; X64-JAG-LABEL: test_mul_by_8: 379 ; X64-JAG: # %bb.0: 380 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 381 ; X64-JAG-NEXT: leal (,%rdi,8), %eax # sched: [2:1.00] 382 ; X64-JAG-NEXT: retq # sched: [4:1.00] 383 ; 384 ; X86-NOOPT-LABEL: test_mul_by_8: 385 ; X86-NOOPT: # %bb.0: 386 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 387 ; X86-NOOPT-NEXT: shll $3, %eax 388 ; X86-NOOPT-NEXT: retl 389 ; 390 ; HSW-NOOPT-LABEL: test_mul_by_8: 391 ; HSW-NOOPT: # %bb.0: 392 ; HSW-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 393 ; HSW-NOOPT-NEXT: leal (,%rdi,8), %eax # sched: [1:0.50] 394 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 395 ; 396 ; JAG-NOOPT-LABEL: test_mul_by_8: 397 ; JAG-NOOPT: # %bb.0: 398 ; JAG-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 399 ; JAG-NOOPT-NEXT: leal (,%rdi,8), %eax # sched: [2:1.00] 400 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 401 ; 402 ; X64-SLM-LABEL: test_mul_by_8: 403 ; X64-SLM: # %bb.0: 404 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 405 ; X64-SLM-NEXT: leal (,%rdi,8), %eax # sched: [1:1.00] 406 ; X64-SLM-NEXT: retq # sched: [4:1.00] 407 ; 408 ; SLM-NOOPT-LABEL: test_mul_by_8: 409 ; SLM-NOOPT: # %bb.0: 410 ; SLM-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 411 ; SLM-NOOPT-NEXT: leal (,%rdi,8), %eax # sched: [1:1.00] 412 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 413 %mul = mul nsw i32 %x, 8 414 ret i32 %mul 415 } 416 417 define i32 @test_mul_by_9(i32 %x) { 418 ; X86-LABEL: test_mul_by_9: 419 ; X86: # %bb.0: 420 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 421 ; X86-NEXT: leal (%eax,%eax,8), %eax 422 ; X86-NEXT: retl 423 ; 424 ; X64-HSW-LABEL: test_mul_by_9: 425 ; X64-HSW: # %bb.0: 426 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 427 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 428 ; X64-HSW-NEXT: retq # sched: [7:1.00] 429 ; 430 ; X64-JAG-LABEL: test_mul_by_9: 431 ; X64-JAG: # %bb.0: 432 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 433 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 434 ; X64-JAG-NEXT: retq # sched: [4:1.00] 435 ; 436 ; X86-NOOPT-LABEL: test_mul_by_9: 437 ; X86-NOOPT: # %bb.0: 438 ; X86-NOOPT-NEXT: imull $9, {{[0-9]+}}(%esp), %eax 439 ; X86-NOOPT-NEXT: retl 440 ; 441 ; HSW-NOOPT-LABEL: test_mul_by_9: 442 ; HSW-NOOPT: # %bb.0: 443 ; HSW-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 444 ; HSW-NOOPT-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 445 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 446 ; 447 ; JAG-NOOPT-LABEL: test_mul_by_9: 448 ; JAG-NOOPT: # %bb.0: 449 ; JAG-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 450 ; JAG-NOOPT-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 451 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 452 ; 453 ; X64-SLM-LABEL: test_mul_by_9: 454 ; X64-SLM: # %bb.0: 455 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 456 ; X64-SLM-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00] 457 ; X64-SLM-NEXT: retq # sched: [4:1.00] 458 ; 459 ; SLM-NOOPT-LABEL: test_mul_by_9: 460 ; SLM-NOOPT: # %bb.0: 461 ; SLM-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 462 ; SLM-NOOPT-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00] 463 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 464 %mul = mul nsw i32 %x, 9 465 ret i32 %mul 466 } 467 468 define i32 @test_mul_by_10(i32 %x) { 469 ; X86-LABEL: test_mul_by_10: 470 ; X86: # %bb.0: 471 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 472 ; X86-NEXT: addl %eax, %eax 473 ; X86-NEXT: leal (%eax,%eax,4), %eax 474 ; X86-NEXT: retl 475 ; 476 ; X64-HSW-LABEL: test_mul_by_10: 477 ; X64-HSW: # %bb.0: 478 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 479 ; X64-HSW-NEXT: addl %edi, %edi # sched: [1:0.25] 480 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 481 ; X64-HSW-NEXT: retq # sched: [7:1.00] 482 ; 483 ; X64-JAG-LABEL: test_mul_by_10: 484 ; X64-JAG: # %bb.0: 485 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 486 ; X64-JAG-NEXT: addl %edi, %edi # sched: [1:0.50] 487 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 488 ; X64-JAG-NEXT: retq # sched: [4:1.00] 489 ; 490 ; X86-NOOPT-LABEL: test_mul_by_10: 491 ; X86-NOOPT: # %bb.0: 492 ; X86-NOOPT-NEXT: imull $10, {{[0-9]+}}(%esp), %eax 493 ; X86-NOOPT-NEXT: retl 494 ; 495 ; HSW-NOOPT-LABEL: test_mul_by_10: 496 ; HSW-NOOPT: # %bb.0: 497 ; HSW-NOOPT-NEXT: imull $10, %edi, %eax # sched: [3:1.00] 498 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 499 ; 500 ; JAG-NOOPT-LABEL: test_mul_by_10: 501 ; JAG-NOOPT: # %bb.0: 502 ; JAG-NOOPT-NEXT: imull $10, %edi, %eax # sched: [3:1.00] 503 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 504 ; 505 ; X64-SLM-LABEL: test_mul_by_10: 506 ; X64-SLM: # %bb.0: 507 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 508 ; X64-SLM-NEXT: addl %edi, %edi # sched: [1:0.50] 509 ; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00] 510 ; X64-SLM-NEXT: retq # sched: [4:1.00] 511 ; 512 ; SLM-NOOPT-LABEL: test_mul_by_10: 513 ; SLM-NOOPT: # %bb.0: 514 ; SLM-NOOPT-NEXT: imull $10, %edi, %eax # sched: [3:1.00] 515 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 516 %mul = mul nsw i32 %x, 10 517 ret i32 %mul 518 } 519 520 define i32 @test_mul_by_11(i32 %x) { 521 ; X86-LABEL: test_mul_by_11: 522 ; X86: # %bb.0: 523 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 524 ; X86-NEXT: leal (%eax,%eax,4), %ecx 525 ; X86-NEXT: leal (%eax,%ecx,2), %eax 526 ; X86-NEXT: retl 527 ; 528 ; X64-HSW-LABEL: test_mul_by_11: 529 ; X64-HSW: # %bb.0: 530 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 531 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 532 ; X64-HSW-NEXT: leal (%rdi,%rax,2), %eax # sched: [1:0.50] 533 ; X64-HSW-NEXT: retq # sched: [7:1.00] 534 ; 535 ; X64-JAG-LABEL: test_mul_by_11: 536 ; X64-JAG: # %bb.0: 537 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 538 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 539 ; X64-JAG-NEXT: leal (%rdi,%rax,2), %eax # sched: [2:1.00] 540 ; X64-JAG-NEXT: retq # sched: [4:1.00] 541 ; 542 ; X86-NOOPT-LABEL: test_mul_by_11: 543 ; X86-NOOPT: # %bb.0: 544 ; X86-NOOPT-NEXT: imull $11, {{[0-9]+}}(%esp), %eax 545 ; X86-NOOPT-NEXT: retl 546 ; 547 ; HSW-NOOPT-LABEL: test_mul_by_11: 548 ; HSW-NOOPT: # %bb.0: 549 ; HSW-NOOPT-NEXT: imull $11, %edi, %eax # sched: [3:1.00] 550 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 551 ; 552 ; JAG-NOOPT-LABEL: test_mul_by_11: 553 ; JAG-NOOPT: # %bb.0: 554 ; JAG-NOOPT-NEXT: imull $11, %edi, %eax # sched: [3:1.00] 555 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 556 ; 557 ; X64-SLM-LABEL: test_mul_by_11: 558 ; X64-SLM: # %bb.0: 559 ; X64-SLM-NEXT: imull $11, %edi, %eax # sched: [3:1.00] 560 ; X64-SLM-NEXT: retq # sched: [4:1.00] 561 ; 562 ; SLM-NOOPT-LABEL: test_mul_by_11: 563 ; SLM-NOOPT: # %bb.0: 564 ; SLM-NOOPT-NEXT: imull $11, %edi, %eax # sched: [3:1.00] 565 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 566 %mul = mul nsw i32 %x, 11 567 ret i32 %mul 568 } 569 570 define i32 @test_mul_by_12(i32 %x) { 571 ; X86-LABEL: test_mul_by_12: 572 ; X86: # %bb.0: 573 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 574 ; X86-NEXT: shll $2, %eax 575 ; X86-NEXT: leal (%eax,%eax,2), %eax 576 ; X86-NEXT: retl 577 ; 578 ; X64-HSW-LABEL: test_mul_by_12: 579 ; X64-HSW: # %bb.0: 580 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 581 ; X64-HSW-NEXT: shll $2, %edi # sched: [1:0.50] 582 ; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50] 583 ; X64-HSW-NEXT: retq # sched: [7:1.00] 584 ; 585 ; X64-JAG-LABEL: test_mul_by_12: 586 ; X64-JAG: # %bb.0: 587 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 588 ; X64-JAG-NEXT: shll $2, %edi # sched: [1:0.50] 589 ; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [2:1.00] 590 ; X64-JAG-NEXT: retq # sched: [4:1.00] 591 ; 592 ; X86-NOOPT-LABEL: test_mul_by_12: 593 ; X86-NOOPT: # %bb.0: 594 ; X86-NOOPT-NEXT: imull $12, {{[0-9]+}}(%esp), %eax 595 ; X86-NOOPT-NEXT: retl 596 ; 597 ; HSW-NOOPT-LABEL: test_mul_by_12: 598 ; HSW-NOOPT: # %bb.0: 599 ; HSW-NOOPT-NEXT: imull $12, %edi, %eax # sched: [3:1.00] 600 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 601 ; 602 ; JAG-NOOPT-LABEL: test_mul_by_12: 603 ; JAG-NOOPT: # %bb.0: 604 ; JAG-NOOPT-NEXT: imull $12, %edi, %eax # sched: [3:1.00] 605 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 606 ; 607 ; X64-SLM-LABEL: test_mul_by_12: 608 ; X64-SLM: # %bb.0: 609 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 610 ; X64-SLM-NEXT: shll $2, %edi # sched: [1:1.00] 611 ; X64-SLM-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00] 612 ; X64-SLM-NEXT: retq # sched: [4:1.00] 613 ; 614 ; SLM-NOOPT-LABEL: test_mul_by_12: 615 ; SLM-NOOPT: # %bb.0: 616 ; SLM-NOOPT-NEXT: imull $12, %edi, %eax # sched: [3:1.00] 617 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 618 %mul = mul nsw i32 %x, 12 619 ret i32 %mul 620 } 621 622 define i32 @test_mul_by_13(i32 %x) { 623 ; X86-LABEL: test_mul_by_13: 624 ; X86: # %bb.0: 625 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 626 ; X86-NEXT: leal (%eax,%eax,2), %ecx 627 ; X86-NEXT: leal (%eax,%ecx,4), %eax 628 ; X86-NEXT: retl 629 ; 630 ; X64-HSW-LABEL: test_mul_by_13: 631 ; X64-HSW: # %bb.0: 632 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 633 ; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50] 634 ; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50] 635 ; X64-HSW-NEXT: retq # sched: [7:1.00] 636 ; 637 ; X64-JAG-LABEL: test_mul_by_13: 638 ; X64-JAG: # %bb.0: 639 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 640 ; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [2:1.00] 641 ; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax # sched: [2:1.00] 642 ; X64-JAG-NEXT: retq # sched: [4:1.00] 643 ; 644 ; X86-NOOPT-LABEL: test_mul_by_13: 645 ; X86-NOOPT: # %bb.0: 646 ; X86-NOOPT-NEXT: imull $13, {{[0-9]+}}(%esp), %eax 647 ; X86-NOOPT-NEXT: retl 648 ; 649 ; HSW-NOOPT-LABEL: test_mul_by_13: 650 ; HSW-NOOPT: # %bb.0: 651 ; HSW-NOOPT-NEXT: imull $13, %edi, %eax # sched: [3:1.00] 652 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 653 ; 654 ; JAG-NOOPT-LABEL: test_mul_by_13: 655 ; JAG-NOOPT: # %bb.0: 656 ; JAG-NOOPT-NEXT: imull $13, %edi, %eax # sched: [3:1.00] 657 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 658 ; 659 ; X64-SLM-LABEL: test_mul_by_13: 660 ; X64-SLM: # %bb.0: 661 ; X64-SLM-NEXT: imull $13, %edi, %eax # sched: [3:1.00] 662 ; X64-SLM-NEXT: retq # sched: [4:1.00] 663 ; 664 ; SLM-NOOPT-LABEL: test_mul_by_13: 665 ; SLM-NOOPT: # %bb.0: 666 ; SLM-NOOPT-NEXT: imull $13, %edi, %eax # sched: [3:1.00] 667 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 668 %mul = mul nsw i32 %x, 13 669 ret i32 %mul 670 } 671 672 define i32 @test_mul_by_14(i32 %x) { 673 ; X86-LABEL: test_mul_by_14: 674 ; X86: # %bb.0: 675 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 676 ; X86-NEXT: movl %ecx, %eax 677 ; X86-NEXT: shll $4, %eax 678 ; X86-NEXT: subl %ecx, %eax 679 ; X86-NEXT: subl %ecx, %eax 680 ; X86-NEXT: retl 681 ; 682 ; X64-HSW-LABEL: test_mul_by_14: 683 ; X64-HSW: # %bb.0: 684 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 685 ; X64-HSW-NEXT: shll $4, %eax # sched: [1:0.50] 686 ; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25] 687 ; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25] 688 ; X64-HSW-NEXT: retq # sched: [7:1.00] 689 ; 690 ; X64-JAG-LABEL: test_mul_by_14: 691 ; X64-JAG: # %bb.0: 692 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 693 ; X64-JAG-NEXT: shll $4, %eax # sched: [1:0.50] 694 ; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50] 695 ; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50] 696 ; X64-JAG-NEXT: retq # sched: [4:1.00] 697 ; 698 ; X86-NOOPT-LABEL: test_mul_by_14: 699 ; X86-NOOPT: # %bb.0: 700 ; X86-NOOPT-NEXT: imull $14, {{[0-9]+}}(%esp), %eax 701 ; X86-NOOPT-NEXT: retl 702 ; 703 ; HSW-NOOPT-LABEL: test_mul_by_14: 704 ; HSW-NOOPT: # %bb.0: 705 ; HSW-NOOPT-NEXT: imull $14, %edi, %eax # sched: [3:1.00] 706 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 707 ; 708 ; JAG-NOOPT-LABEL: test_mul_by_14: 709 ; JAG-NOOPT: # %bb.0: 710 ; JAG-NOOPT-NEXT: imull $14, %edi, %eax # sched: [3:1.00] 711 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 712 ; 713 ; X64-SLM-LABEL: test_mul_by_14: 714 ; X64-SLM: # %bb.0: 715 ; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50] 716 ; X64-SLM-NEXT: shll $4, %eax # sched: [1:1.00] 717 ; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50] 718 ; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50] 719 ; X64-SLM-NEXT: retq # sched: [4:1.00] 720 ; 721 ; SLM-NOOPT-LABEL: test_mul_by_14: 722 ; SLM-NOOPT: # %bb.0: 723 ; SLM-NOOPT-NEXT: imull $14, %edi, %eax # sched: [3:1.00] 724 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 725 %mul = mul nsw i32 %x, 14 726 ret i32 %mul 727 } 728 729 define i32 @test_mul_by_15(i32 %x) { 730 ; X86-LABEL: test_mul_by_15: 731 ; X86: # %bb.0: 732 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 733 ; X86-NEXT: leal (%eax,%eax,4), %eax 734 ; X86-NEXT: leal (%eax,%eax,2), %eax 735 ; X86-NEXT: retl 736 ; 737 ; X64-HSW-LABEL: test_mul_by_15: 738 ; X64-HSW: # %bb.0: 739 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 740 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 741 ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50] 742 ; X64-HSW-NEXT: retq # sched: [7:1.00] 743 ; 744 ; X64-JAG-LABEL: test_mul_by_15: 745 ; X64-JAG: # %bb.0: 746 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 747 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 748 ; X64-JAG-NEXT: leal (%rax,%rax,2), %eax # sched: [2:1.00] 749 ; X64-JAG-NEXT: retq # sched: [4:1.00] 750 ; 751 ; X86-NOOPT-LABEL: test_mul_by_15: 752 ; X86-NOOPT: # %bb.0: 753 ; X86-NOOPT-NEXT: imull $15, {{[0-9]+}}(%esp), %eax 754 ; X86-NOOPT-NEXT: retl 755 ; 756 ; HSW-NOOPT-LABEL: test_mul_by_15: 757 ; HSW-NOOPT: # %bb.0: 758 ; HSW-NOOPT-NEXT: imull $15, %edi, %eax # sched: [3:1.00] 759 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 760 ; 761 ; JAG-NOOPT-LABEL: test_mul_by_15: 762 ; JAG-NOOPT: # %bb.0: 763 ; JAG-NOOPT-NEXT: imull $15, %edi, %eax # sched: [3:1.00] 764 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 765 ; 766 ; X64-SLM-LABEL: test_mul_by_15: 767 ; X64-SLM: # %bb.0: 768 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 769 ; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00] 770 ; X64-SLM-NEXT: leal (%rax,%rax,2), %eax # sched: [1:1.00] 771 ; X64-SLM-NEXT: retq # sched: [4:1.00] 772 ; 773 ; SLM-NOOPT-LABEL: test_mul_by_15: 774 ; SLM-NOOPT: # %bb.0: 775 ; SLM-NOOPT-NEXT: imull $15, %edi, %eax # sched: [3:1.00] 776 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 777 %mul = mul nsw i32 %x, 15 778 ret i32 %mul 779 } 780 781 define i32 @test_mul_by_16(i32 %x) { 782 ; X86-LABEL: test_mul_by_16: 783 ; X86: # %bb.0: 784 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 785 ; X86-NEXT: shll $4, %eax 786 ; X86-NEXT: retl 787 ; 788 ; X64-HSW-LABEL: test_mul_by_16: 789 ; X64-HSW: # %bb.0: 790 ; X64-HSW-NEXT: shll $4, %edi # sched: [1:0.50] 791 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 792 ; X64-HSW-NEXT: retq # sched: [7:1.00] 793 ; 794 ; X64-JAG-LABEL: test_mul_by_16: 795 ; X64-JAG: # %bb.0: 796 ; X64-JAG-NEXT: shll $4, %edi # sched: [1:0.50] 797 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 798 ; X64-JAG-NEXT: retq # sched: [4:1.00] 799 ; 800 ; X86-NOOPT-LABEL: test_mul_by_16: 801 ; X86-NOOPT: # %bb.0: 802 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 803 ; X86-NOOPT-NEXT: shll $4, %eax 804 ; X86-NOOPT-NEXT: retl 805 ; 806 ; HSW-NOOPT-LABEL: test_mul_by_16: 807 ; HSW-NOOPT: # %bb.0: 808 ; HSW-NOOPT-NEXT: shll $4, %edi # sched: [1:0.50] 809 ; HSW-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.25] 810 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 811 ; 812 ; JAG-NOOPT-LABEL: test_mul_by_16: 813 ; JAG-NOOPT: # %bb.0: 814 ; JAG-NOOPT-NEXT: shll $4, %edi # sched: [1:0.50] 815 ; JAG-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.50] 816 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 817 ; 818 ; X64-SLM-LABEL: test_mul_by_16: 819 ; X64-SLM: # %bb.0: 820 ; X64-SLM-NEXT: shll $4, %edi # sched: [1:1.00] 821 ; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50] 822 ; X64-SLM-NEXT: retq # sched: [4:1.00] 823 ; 824 ; SLM-NOOPT-LABEL: test_mul_by_16: 825 ; SLM-NOOPT: # %bb.0: 826 ; SLM-NOOPT-NEXT: shll $4, %edi # sched: [1:1.00] 827 ; SLM-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.50] 828 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 829 %mul = mul nsw i32 %x, 16 830 ret i32 %mul 831 } 832 833 define i32 @test_mul_by_17(i32 %x) { 834 ; X86-LABEL: test_mul_by_17: 835 ; X86: # %bb.0: 836 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 837 ; X86-NEXT: movl %ecx, %eax 838 ; X86-NEXT: shll $4, %eax 839 ; X86-NEXT: addl %ecx, %eax 840 ; X86-NEXT: retl 841 ; 842 ; X64-HSW-LABEL: test_mul_by_17: 843 ; X64-HSW: # %bb.0: 844 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 845 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 846 ; X64-HSW-NEXT: shll $4, %eax # sched: [1:0.50] 847 ; X64-HSW-NEXT: leal (%rax,%rdi), %eax # sched: [1:0.50] 848 ; X64-HSW-NEXT: retq # sched: [7:1.00] 849 ; 850 ; X64-JAG-LABEL: test_mul_by_17: 851 ; X64-JAG: # %bb.0: 852 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 853 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 854 ; X64-JAG-NEXT: shll $4, %eax # sched: [1:0.50] 855 ; X64-JAG-NEXT: leal (%rax,%rdi), %eax # sched: [1:0.50] 856 ; X64-JAG-NEXT: retq # sched: [4:1.00] 857 ; 858 ; X86-NOOPT-LABEL: test_mul_by_17: 859 ; X86-NOOPT: # %bb.0: 860 ; X86-NOOPT-NEXT: imull $17, {{[0-9]+}}(%esp), %eax 861 ; X86-NOOPT-NEXT: retl 862 ; 863 ; HSW-NOOPT-LABEL: test_mul_by_17: 864 ; HSW-NOOPT: # %bb.0: 865 ; HSW-NOOPT-NEXT: imull $17, %edi, %eax # sched: [3:1.00] 866 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 867 ; 868 ; JAG-NOOPT-LABEL: test_mul_by_17: 869 ; JAG-NOOPT: # %bb.0: 870 ; JAG-NOOPT-NEXT: imull $17, %edi, %eax # sched: [3:1.00] 871 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 872 ; 873 ; X64-SLM-LABEL: test_mul_by_17: 874 ; X64-SLM: # %bb.0: 875 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 876 ; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50] 877 ; X64-SLM-NEXT: shll $4, %eax # sched: [1:1.00] 878 ; X64-SLM-NEXT: leal (%rax,%rdi), %eax # sched: [1:1.00] 879 ; X64-SLM-NEXT: retq # sched: [4:1.00] 880 ; 881 ; SLM-NOOPT-LABEL: test_mul_by_17: 882 ; SLM-NOOPT: # %bb.0: 883 ; SLM-NOOPT-NEXT: imull $17, %edi, %eax # sched: [3:1.00] 884 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 885 %mul = mul nsw i32 %x, 17 886 ret i32 %mul 887 } 888 889 define i32 @test_mul_by_18(i32 %x) { 890 ; X86-LABEL: test_mul_by_18: 891 ; X86: # %bb.0: 892 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 893 ; X86-NEXT: addl %eax, %eax 894 ; X86-NEXT: leal (%eax,%eax,8), %eax 895 ; X86-NEXT: retl 896 ; 897 ; X64-HSW-LABEL: test_mul_by_18: 898 ; X64-HSW: # %bb.0: 899 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 900 ; X64-HSW-NEXT: addl %edi, %edi # sched: [1:0.25] 901 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 902 ; X64-HSW-NEXT: retq # sched: [7:1.00] 903 ; 904 ; X64-JAG-LABEL: test_mul_by_18: 905 ; X64-JAG: # %bb.0: 906 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 907 ; X64-JAG-NEXT: addl %edi, %edi # sched: [1:0.50] 908 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 909 ; X64-JAG-NEXT: retq # sched: [4:1.00] 910 ; 911 ; X86-NOOPT-LABEL: test_mul_by_18: 912 ; X86-NOOPT: # %bb.0: 913 ; X86-NOOPT-NEXT: imull $18, {{[0-9]+}}(%esp), %eax 914 ; X86-NOOPT-NEXT: retl 915 ; 916 ; HSW-NOOPT-LABEL: test_mul_by_18: 917 ; HSW-NOOPT: # %bb.0: 918 ; HSW-NOOPT-NEXT: imull $18, %edi, %eax # sched: [3:1.00] 919 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 920 ; 921 ; JAG-NOOPT-LABEL: test_mul_by_18: 922 ; JAG-NOOPT: # %bb.0: 923 ; JAG-NOOPT-NEXT: imull $18, %edi, %eax # sched: [3:1.00] 924 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 925 ; 926 ; X64-SLM-LABEL: test_mul_by_18: 927 ; X64-SLM: # %bb.0: 928 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 929 ; X64-SLM-NEXT: addl %edi, %edi # sched: [1:0.50] 930 ; X64-SLM-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00] 931 ; X64-SLM-NEXT: retq # sched: [4:1.00] 932 ; 933 ; SLM-NOOPT-LABEL: test_mul_by_18: 934 ; SLM-NOOPT: # %bb.0: 935 ; SLM-NOOPT-NEXT: imull $18, %edi, %eax # sched: [3:1.00] 936 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 937 %mul = mul nsw i32 %x, 18 938 ret i32 %mul 939 } 940 941 define i32 @test_mul_by_19(i32 %x) { 942 ; X86-LABEL: test_mul_by_19: 943 ; X86: # %bb.0: 944 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 945 ; X86-NEXT: leal (%eax,%eax,8), %ecx 946 ; X86-NEXT: leal (%eax,%ecx,2), %eax 947 ; X86-NEXT: retl 948 ; 949 ; X64-HSW-LABEL: test_mul_by_19: 950 ; X64-HSW: # %bb.0: 951 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 952 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 953 ; X64-HSW-NEXT: leal (%rdi,%rax,2), %eax # sched: [1:0.50] 954 ; X64-HSW-NEXT: retq # sched: [7:1.00] 955 ; 956 ; X64-JAG-LABEL: test_mul_by_19: 957 ; X64-JAG: # %bb.0: 958 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 959 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 960 ; X64-JAG-NEXT: leal (%rdi,%rax,2), %eax # sched: [2:1.00] 961 ; X64-JAG-NEXT: retq # sched: [4:1.00] 962 ; 963 ; X86-NOOPT-LABEL: test_mul_by_19: 964 ; X86-NOOPT: # %bb.0: 965 ; X86-NOOPT-NEXT: imull $19, {{[0-9]+}}(%esp), %eax 966 ; X86-NOOPT-NEXT: retl 967 ; 968 ; HSW-NOOPT-LABEL: test_mul_by_19: 969 ; HSW-NOOPT: # %bb.0: 970 ; HSW-NOOPT-NEXT: imull $19, %edi, %eax # sched: [3:1.00] 971 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 972 ; 973 ; JAG-NOOPT-LABEL: test_mul_by_19: 974 ; JAG-NOOPT: # %bb.0: 975 ; JAG-NOOPT-NEXT: imull $19, %edi, %eax # sched: [3:1.00] 976 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 977 ; 978 ; X64-SLM-LABEL: test_mul_by_19: 979 ; X64-SLM: # %bb.0: 980 ; X64-SLM-NEXT: imull $19, %edi, %eax # sched: [3:1.00] 981 ; X64-SLM-NEXT: retq # sched: [4:1.00] 982 ; 983 ; SLM-NOOPT-LABEL: test_mul_by_19: 984 ; SLM-NOOPT: # %bb.0: 985 ; SLM-NOOPT-NEXT: imull $19, %edi, %eax # sched: [3:1.00] 986 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 987 %mul = mul nsw i32 %x, 19 988 ret i32 %mul 989 } 990 991 define i32 @test_mul_by_20(i32 %x) { 992 ; X86-LABEL: test_mul_by_20: 993 ; X86: # %bb.0: 994 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 995 ; X86-NEXT: shll $2, %eax 996 ; X86-NEXT: leal (%eax,%eax,4), %eax 997 ; X86-NEXT: retl 998 ; 999 ; X64-HSW-LABEL: test_mul_by_20: 1000 ; X64-HSW: # %bb.0: 1001 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1002 ; X64-HSW-NEXT: shll $2, %edi # sched: [1:0.50] 1003 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 1004 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1005 ; 1006 ; X64-JAG-LABEL: test_mul_by_20: 1007 ; X64-JAG: # %bb.0: 1008 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1009 ; X64-JAG-NEXT: shll $2, %edi # sched: [1:0.50] 1010 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 1011 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1012 ; 1013 ; X86-NOOPT-LABEL: test_mul_by_20: 1014 ; X86-NOOPT: # %bb.0: 1015 ; X86-NOOPT-NEXT: imull $20, {{[0-9]+}}(%esp), %eax 1016 ; X86-NOOPT-NEXT: retl 1017 ; 1018 ; HSW-NOOPT-LABEL: test_mul_by_20: 1019 ; HSW-NOOPT: # %bb.0: 1020 ; HSW-NOOPT-NEXT: imull $20, %edi, %eax # sched: [3:1.00] 1021 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1022 ; 1023 ; JAG-NOOPT-LABEL: test_mul_by_20: 1024 ; JAG-NOOPT: # %bb.0: 1025 ; JAG-NOOPT-NEXT: imull $20, %edi, %eax # sched: [3:1.00] 1026 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1027 ; 1028 ; X64-SLM-LABEL: test_mul_by_20: 1029 ; X64-SLM: # %bb.0: 1030 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 1031 ; X64-SLM-NEXT: shll $2, %edi # sched: [1:1.00] 1032 ; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00] 1033 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1034 ; 1035 ; SLM-NOOPT-LABEL: test_mul_by_20: 1036 ; SLM-NOOPT: # %bb.0: 1037 ; SLM-NOOPT-NEXT: imull $20, %edi, %eax # sched: [3:1.00] 1038 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1039 %mul = mul nsw i32 %x, 20 1040 ret i32 %mul 1041 } 1042 1043 define i32 @test_mul_by_21(i32 %x) { 1044 ; X86-LABEL: test_mul_by_21: 1045 ; X86: # %bb.0: 1046 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1047 ; X86-NEXT: leal (%eax,%eax,4), %ecx 1048 ; X86-NEXT: leal (%eax,%ecx,4), %eax 1049 ; X86-NEXT: retl 1050 ; 1051 ; X64-HSW-LABEL: test_mul_by_21: 1052 ; X64-HSW: # %bb.0: 1053 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1054 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 1055 ; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50] 1056 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1057 ; 1058 ; X64-JAG-LABEL: test_mul_by_21: 1059 ; X64-JAG: # %bb.0: 1060 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1061 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 1062 ; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax # sched: [2:1.00] 1063 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1064 ; 1065 ; X86-NOOPT-LABEL: test_mul_by_21: 1066 ; X86-NOOPT: # %bb.0: 1067 ; X86-NOOPT-NEXT: imull $21, {{[0-9]+}}(%esp), %eax 1068 ; X86-NOOPT-NEXT: retl 1069 ; 1070 ; HSW-NOOPT-LABEL: test_mul_by_21: 1071 ; HSW-NOOPT: # %bb.0: 1072 ; HSW-NOOPT-NEXT: imull $21, %edi, %eax # sched: [3:1.00] 1073 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1074 ; 1075 ; JAG-NOOPT-LABEL: test_mul_by_21: 1076 ; JAG-NOOPT: # %bb.0: 1077 ; JAG-NOOPT-NEXT: imull $21, %edi, %eax # sched: [3:1.00] 1078 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1079 ; 1080 ; X64-SLM-LABEL: test_mul_by_21: 1081 ; X64-SLM: # %bb.0: 1082 ; X64-SLM-NEXT: imull $21, %edi, %eax # sched: [3:1.00] 1083 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1084 ; 1085 ; SLM-NOOPT-LABEL: test_mul_by_21: 1086 ; SLM-NOOPT: # %bb.0: 1087 ; SLM-NOOPT-NEXT: imull $21, %edi, %eax # sched: [3:1.00] 1088 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1089 %mul = mul nsw i32 %x, 21 1090 ret i32 %mul 1091 } 1092 1093 define i32 @test_mul_by_22(i32 %x) { 1094 ; X86-LABEL: test_mul_by_22: 1095 ; X86: # %bb.0: 1096 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1097 ; X86-NEXT: leal (%ecx,%ecx,4), %eax 1098 ; X86-NEXT: leal (%ecx,%eax,4), %eax 1099 ; X86-NEXT: addl %ecx, %eax 1100 ; X86-NEXT: retl 1101 ; 1102 ; X64-HSW-LABEL: test_mul_by_22: 1103 ; X64-HSW: # %bb.0: 1104 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1105 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 1106 ; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50] 1107 ; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25] 1108 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1109 ; 1110 ; X64-JAG-LABEL: test_mul_by_22: 1111 ; X64-JAG: # %bb.0: 1112 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1113 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 1114 ; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax # sched: [2:1.00] 1115 ; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50] 1116 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1117 ; 1118 ; X86-NOOPT-LABEL: test_mul_by_22: 1119 ; X86-NOOPT: # %bb.0: 1120 ; X86-NOOPT-NEXT: imull $22, {{[0-9]+}}(%esp), %eax 1121 ; X86-NOOPT-NEXT: retl 1122 ; 1123 ; HSW-NOOPT-LABEL: test_mul_by_22: 1124 ; HSW-NOOPT: # %bb.0: 1125 ; HSW-NOOPT-NEXT: imull $22, %edi, %eax # sched: [3:1.00] 1126 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1127 ; 1128 ; JAG-NOOPT-LABEL: test_mul_by_22: 1129 ; JAG-NOOPT: # %bb.0: 1130 ; JAG-NOOPT-NEXT: imull $22, %edi, %eax # sched: [3:1.00] 1131 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1132 ; 1133 ; X64-SLM-LABEL: test_mul_by_22: 1134 ; X64-SLM: # %bb.0: 1135 ; X64-SLM-NEXT: imull $22, %edi, %eax # sched: [3:1.00] 1136 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1137 ; 1138 ; SLM-NOOPT-LABEL: test_mul_by_22: 1139 ; SLM-NOOPT: # %bb.0: 1140 ; SLM-NOOPT-NEXT: imull $22, %edi, %eax # sched: [3:1.00] 1141 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1142 %mul = mul nsw i32 %x, 22 1143 ret i32 %mul 1144 } 1145 1146 define i32 @test_mul_by_23(i32 %x) { 1147 ; X86-LABEL: test_mul_by_23: 1148 ; X86: # %bb.0: 1149 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1150 ; X86-NEXT: leal (%ecx,%ecx,2), %eax 1151 ; X86-NEXT: shll $3, %eax 1152 ; X86-NEXT: subl %ecx, %eax 1153 ; X86-NEXT: retl 1154 ; 1155 ; X64-HSW-LABEL: test_mul_by_23: 1156 ; X64-HSW: # %bb.0: 1157 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1158 ; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50] 1159 ; X64-HSW-NEXT: shll $3, %eax # sched: [1:0.50] 1160 ; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25] 1161 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1162 ; 1163 ; X64-JAG-LABEL: test_mul_by_23: 1164 ; X64-JAG: # %bb.0: 1165 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1166 ; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [2:1.00] 1167 ; X64-JAG-NEXT: shll $3, %eax # sched: [1:0.50] 1168 ; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50] 1169 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1170 ; 1171 ; X86-NOOPT-LABEL: test_mul_by_23: 1172 ; X86-NOOPT: # %bb.0: 1173 ; X86-NOOPT-NEXT: imull $23, {{[0-9]+}}(%esp), %eax 1174 ; X86-NOOPT-NEXT: retl 1175 ; 1176 ; HSW-NOOPT-LABEL: test_mul_by_23: 1177 ; HSW-NOOPT: # %bb.0: 1178 ; HSW-NOOPT-NEXT: imull $23, %edi, %eax # sched: [3:1.00] 1179 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1180 ; 1181 ; JAG-NOOPT-LABEL: test_mul_by_23: 1182 ; JAG-NOOPT: # %bb.0: 1183 ; JAG-NOOPT-NEXT: imull $23, %edi, %eax # sched: [3:1.00] 1184 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1185 ; 1186 ; X64-SLM-LABEL: test_mul_by_23: 1187 ; X64-SLM: # %bb.0: 1188 ; X64-SLM-NEXT: imull $23, %edi, %eax # sched: [3:1.00] 1189 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1190 ; 1191 ; SLM-NOOPT-LABEL: test_mul_by_23: 1192 ; SLM-NOOPT: # %bb.0: 1193 ; SLM-NOOPT-NEXT: imull $23, %edi, %eax # sched: [3:1.00] 1194 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1195 %mul = mul nsw i32 %x, 23 1196 ret i32 %mul 1197 } 1198 1199 define i32 @test_mul_by_24(i32 %x) { 1200 ; X86-LABEL: test_mul_by_24: 1201 ; X86: # %bb.0: 1202 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1203 ; X86-NEXT: shll $3, %eax 1204 ; X86-NEXT: leal (%eax,%eax,2), %eax 1205 ; X86-NEXT: retl 1206 ; 1207 ; X64-HSW-LABEL: test_mul_by_24: 1208 ; X64-HSW: # %bb.0: 1209 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1210 ; X64-HSW-NEXT: shll $3, %edi # sched: [1:0.50] 1211 ; X64-HSW-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:0.50] 1212 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1213 ; 1214 ; X64-JAG-LABEL: test_mul_by_24: 1215 ; X64-JAG: # %bb.0: 1216 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1217 ; X64-JAG-NEXT: shll $3, %edi # sched: [1:0.50] 1218 ; X64-JAG-NEXT: leal (%rdi,%rdi,2), %eax # sched: [2:1.00] 1219 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1220 ; 1221 ; X86-NOOPT-LABEL: test_mul_by_24: 1222 ; X86-NOOPT: # %bb.0: 1223 ; X86-NOOPT-NEXT: imull $24, {{[0-9]+}}(%esp), %eax 1224 ; X86-NOOPT-NEXT: retl 1225 ; 1226 ; HSW-NOOPT-LABEL: test_mul_by_24: 1227 ; HSW-NOOPT: # %bb.0: 1228 ; HSW-NOOPT-NEXT: imull $24, %edi, %eax # sched: [3:1.00] 1229 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1230 ; 1231 ; JAG-NOOPT-LABEL: test_mul_by_24: 1232 ; JAG-NOOPT: # %bb.0: 1233 ; JAG-NOOPT-NEXT: imull $24, %edi, %eax # sched: [3:1.00] 1234 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1235 ; 1236 ; X64-SLM-LABEL: test_mul_by_24: 1237 ; X64-SLM: # %bb.0: 1238 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 1239 ; X64-SLM-NEXT: shll $3, %edi # sched: [1:1.00] 1240 ; X64-SLM-NEXT: leal (%rdi,%rdi,2), %eax # sched: [1:1.00] 1241 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1242 ; 1243 ; SLM-NOOPT-LABEL: test_mul_by_24: 1244 ; SLM-NOOPT: # %bb.0: 1245 ; SLM-NOOPT-NEXT: imull $24, %edi, %eax # sched: [3:1.00] 1246 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1247 %mul = mul nsw i32 %x, 24 1248 ret i32 %mul 1249 } 1250 1251 define i32 @test_mul_by_25(i32 %x) { 1252 ; X86-LABEL: test_mul_by_25: 1253 ; X86: # %bb.0: 1254 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1255 ; X86-NEXT: leal (%eax,%eax,4), %eax 1256 ; X86-NEXT: leal (%eax,%eax,4), %eax 1257 ; X86-NEXT: retl 1258 ; 1259 ; X64-HSW-LABEL: test_mul_by_25: 1260 ; X64-HSW: # %bb.0: 1261 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1262 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 1263 ; X64-HSW-NEXT: leal (%rax,%rax,4), %eax # sched: [1:0.50] 1264 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1265 ; 1266 ; X64-JAG-LABEL: test_mul_by_25: 1267 ; X64-JAG: # %bb.0: 1268 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1269 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 1270 ; X64-JAG-NEXT: leal (%rax,%rax,4), %eax # sched: [2:1.00] 1271 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1272 ; 1273 ; X86-NOOPT-LABEL: test_mul_by_25: 1274 ; X86-NOOPT: # %bb.0: 1275 ; X86-NOOPT-NEXT: imull $25, {{[0-9]+}}(%esp), %eax 1276 ; X86-NOOPT-NEXT: retl 1277 ; 1278 ; HSW-NOOPT-LABEL: test_mul_by_25: 1279 ; HSW-NOOPT: # %bb.0: 1280 ; HSW-NOOPT-NEXT: imull $25, %edi, %eax # sched: [3:1.00] 1281 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1282 ; 1283 ; JAG-NOOPT-LABEL: test_mul_by_25: 1284 ; JAG-NOOPT: # %bb.0: 1285 ; JAG-NOOPT-NEXT: imull $25, %edi, %eax # sched: [3:1.00] 1286 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1287 ; 1288 ; X64-SLM-LABEL: test_mul_by_25: 1289 ; X64-SLM: # %bb.0: 1290 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 1291 ; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00] 1292 ; X64-SLM-NEXT: leal (%rax,%rax,4), %eax # sched: [1:1.00] 1293 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1294 ; 1295 ; SLM-NOOPT-LABEL: test_mul_by_25: 1296 ; SLM-NOOPT: # %bb.0: 1297 ; SLM-NOOPT-NEXT: imull $25, %edi, %eax # sched: [3:1.00] 1298 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1299 %mul = mul nsw i32 %x, 25 1300 ret i32 %mul 1301 } 1302 1303 define i32 @test_mul_by_26(i32 %x) { 1304 ; X86-LABEL: test_mul_by_26: 1305 ; X86: # %bb.0: 1306 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1307 ; X86-NEXT: leal (%ecx,%ecx,4), %eax 1308 ; X86-NEXT: leal (%eax,%eax,4), %eax 1309 ; X86-NEXT: addl %ecx, %eax 1310 ; X86-NEXT: retl 1311 ; 1312 ; X64-HSW-LABEL: test_mul_by_26: 1313 ; X64-HSW: # %bb.0: 1314 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1315 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 1316 ; X64-HSW-NEXT: leal (%rax,%rax,4), %eax # sched: [1:0.50] 1317 ; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25] 1318 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1319 ; 1320 ; X64-JAG-LABEL: test_mul_by_26: 1321 ; X64-JAG: # %bb.0: 1322 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1323 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 1324 ; X64-JAG-NEXT: leal (%rax,%rax,4), %eax # sched: [2:1.00] 1325 ; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50] 1326 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1327 ; 1328 ; X86-NOOPT-LABEL: test_mul_by_26: 1329 ; X86-NOOPT: # %bb.0: 1330 ; X86-NOOPT-NEXT: imull $26, {{[0-9]+}}(%esp), %eax 1331 ; X86-NOOPT-NEXT: retl 1332 ; 1333 ; HSW-NOOPT-LABEL: test_mul_by_26: 1334 ; HSW-NOOPT: # %bb.0: 1335 ; HSW-NOOPT-NEXT: imull $26, %edi, %eax # sched: [3:1.00] 1336 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1337 ; 1338 ; JAG-NOOPT-LABEL: test_mul_by_26: 1339 ; JAG-NOOPT: # %bb.0: 1340 ; JAG-NOOPT-NEXT: imull $26, %edi, %eax # sched: [3:1.00] 1341 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1342 ; 1343 ; X64-SLM-LABEL: test_mul_by_26: 1344 ; X64-SLM: # %bb.0: 1345 ; X64-SLM-NEXT: imull $26, %edi, %eax # sched: [3:1.00] 1346 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1347 ; 1348 ; SLM-NOOPT-LABEL: test_mul_by_26: 1349 ; SLM-NOOPT: # %bb.0: 1350 ; SLM-NOOPT-NEXT: imull $26, %edi, %eax # sched: [3:1.00] 1351 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1352 %mul = mul nsw i32 %x, 26 1353 ret i32 %mul 1354 } 1355 1356 define i32 @test_mul_by_27(i32 %x) { 1357 ; X86-LABEL: test_mul_by_27: 1358 ; X86: # %bb.0: 1359 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1360 ; X86-NEXT: leal (%eax,%eax,8), %eax 1361 ; X86-NEXT: leal (%eax,%eax,2), %eax 1362 ; X86-NEXT: retl 1363 ; 1364 ; X64-HSW-LABEL: test_mul_by_27: 1365 ; X64-HSW: # %bb.0: 1366 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1367 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 1368 ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50] 1369 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1370 ; 1371 ; X64-JAG-LABEL: test_mul_by_27: 1372 ; X64-JAG: # %bb.0: 1373 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1374 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 1375 ; X64-JAG-NEXT: leal (%rax,%rax,2), %eax # sched: [2:1.00] 1376 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1377 ; 1378 ; X86-NOOPT-LABEL: test_mul_by_27: 1379 ; X86-NOOPT: # %bb.0: 1380 ; X86-NOOPT-NEXT: imull $27, {{[0-9]+}}(%esp), %eax 1381 ; X86-NOOPT-NEXT: retl 1382 ; 1383 ; HSW-NOOPT-LABEL: test_mul_by_27: 1384 ; HSW-NOOPT: # %bb.0: 1385 ; HSW-NOOPT-NEXT: imull $27, %edi, %eax # sched: [3:1.00] 1386 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1387 ; 1388 ; JAG-NOOPT-LABEL: test_mul_by_27: 1389 ; JAG-NOOPT: # %bb.0: 1390 ; JAG-NOOPT-NEXT: imull $27, %edi, %eax # sched: [3:1.00] 1391 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1392 ; 1393 ; X64-SLM-LABEL: test_mul_by_27: 1394 ; X64-SLM: # %bb.0: 1395 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 1396 ; X64-SLM-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00] 1397 ; X64-SLM-NEXT: leal (%rax,%rax,2), %eax # sched: [1:1.00] 1398 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1399 ; 1400 ; SLM-NOOPT-LABEL: test_mul_by_27: 1401 ; SLM-NOOPT: # %bb.0: 1402 ; SLM-NOOPT-NEXT: imull $27, %edi, %eax # sched: [3:1.00] 1403 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1404 %mul = mul nsw i32 %x, 27 1405 ret i32 %mul 1406 } 1407 1408 define i32 @test_mul_by_28(i32 %x) { 1409 ; X86-LABEL: test_mul_by_28: 1410 ; X86: # %bb.0: 1411 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1412 ; X86-NEXT: leal (%ecx,%ecx,8), %eax 1413 ; X86-NEXT: leal (%eax,%eax,2), %eax 1414 ; X86-NEXT: addl %ecx, %eax 1415 ; X86-NEXT: retl 1416 ; 1417 ; X64-HSW-LABEL: test_mul_by_28: 1418 ; X64-HSW: # %bb.0: 1419 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1420 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 1421 ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50] 1422 ; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25] 1423 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1424 ; 1425 ; X64-JAG-LABEL: test_mul_by_28: 1426 ; X64-JAG: # %bb.0: 1427 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1428 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 1429 ; X64-JAG-NEXT: leal (%rax,%rax,2), %eax # sched: [2:1.00] 1430 ; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50] 1431 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1432 ; 1433 ; X86-NOOPT-LABEL: test_mul_by_28: 1434 ; X86-NOOPT: # %bb.0: 1435 ; X86-NOOPT-NEXT: imull $28, {{[0-9]+}}(%esp), %eax 1436 ; X86-NOOPT-NEXT: retl 1437 ; 1438 ; HSW-NOOPT-LABEL: test_mul_by_28: 1439 ; HSW-NOOPT: # %bb.0: 1440 ; HSW-NOOPT-NEXT: imull $28, %edi, %eax # sched: [3:1.00] 1441 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1442 ; 1443 ; JAG-NOOPT-LABEL: test_mul_by_28: 1444 ; JAG-NOOPT: # %bb.0: 1445 ; JAG-NOOPT-NEXT: imull $28, %edi, %eax # sched: [3:1.00] 1446 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1447 ; 1448 ; X64-SLM-LABEL: test_mul_by_28: 1449 ; X64-SLM: # %bb.0: 1450 ; X64-SLM-NEXT: imull $28, %edi, %eax # sched: [3:1.00] 1451 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1452 ; 1453 ; SLM-NOOPT-LABEL: test_mul_by_28: 1454 ; SLM-NOOPT: # %bb.0: 1455 ; SLM-NOOPT-NEXT: imull $28, %edi, %eax # sched: [3:1.00] 1456 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1457 %mul = mul nsw i32 %x, 28 1458 ret i32 %mul 1459 } 1460 1461 define i32 @test_mul_by_29(i32 %x) { 1462 ; X86-LABEL: test_mul_by_29: 1463 ; X86: # %bb.0: 1464 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1465 ; X86-NEXT: leal (%ecx,%ecx,8), %eax 1466 ; X86-NEXT: leal (%eax,%eax,2), %eax 1467 ; X86-NEXT: addl %ecx, %eax 1468 ; X86-NEXT: addl %ecx, %eax 1469 ; X86-NEXT: retl 1470 ; 1471 ; X64-HSW-LABEL: test_mul_by_29: 1472 ; X64-HSW: # %bb.0: 1473 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1474 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 1475 ; X64-HSW-NEXT: leal (%rax,%rax,2), %eax # sched: [1:0.50] 1476 ; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25] 1477 ; X64-HSW-NEXT: addl %edi, %eax # sched: [1:0.25] 1478 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1479 ; 1480 ; X64-JAG-LABEL: test_mul_by_29: 1481 ; X64-JAG: # %bb.0: 1482 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1483 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 1484 ; X64-JAG-NEXT: leal (%rax,%rax,2), %eax # sched: [2:1.00] 1485 ; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50] 1486 ; X64-JAG-NEXT: addl %edi, %eax # sched: [1:0.50] 1487 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1488 ; 1489 ; X86-NOOPT-LABEL: test_mul_by_29: 1490 ; X86-NOOPT: # %bb.0: 1491 ; X86-NOOPT-NEXT: imull $29, {{[0-9]+}}(%esp), %eax 1492 ; X86-NOOPT-NEXT: retl 1493 ; 1494 ; HSW-NOOPT-LABEL: test_mul_by_29: 1495 ; HSW-NOOPT: # %bb.0: 1496 ; HSW-NOOPT-NEXT: imull $29, %edi, %eax # sched: [3:1.00] 1497 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1498 ; 1499 ; JAG-NOOPT-LABEL: test_mul_by_29: 1500 ; JAG-NOOPT: # %bb.0: 1501 ; JAG-NOOPT-NEXT: imull $29, %edi, %eax # sched: [3:1.00] 1502 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1503 ; 1504 ; X64-SLM-LABEL: test_mul_by_29: 1505 ; X64-SLM: # %bb.0: 1506 ; X64-SLM-NEXT: imull $29, %edi, %eax # sched: [3:1.00] 1507 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1508 ; 1509 ; SLM-NOOPT-LABEL: test_mul_by_29: 1510 ; SLM-NOOPT: # %bb.0: 1511 ; SLM-NOOPT-NEXT: imull $29, %edi, %eax # sched: [3:1.00] 1512 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1513 %mul = mul nsw i32 %x, 29 1514 ret i32 %mul 1515 } 1516 1517 define i32 @test_mul_by_30(i32 %x) { 1518 ; X86-LABEL: test_mul_by_30: 1519 ; X86: # %bb.0: 1520 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1521 ; X86-NEXT: movl %ecx, %eax 1522 ; X86-NEXT: shll $5, %eax 1523 ; X86-NEXT: subl %ecx, %eax 1524 ; X86-NEXT: subl %ecx, %eax 1525 ; X86-NEXT: retl 1526 ; 1527 ; X64-HSW-LABEL: test_mul_by_30: 1528 ; X64-HSW: # %bb.0: 1529 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 1530 ; X64-HSW-NEXT: shll $5, %eax # sched: [1:0.50] 1531 ; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25] 1532 ; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25] 1533 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1534 ; 1535 ; X64-JAG-LABEL: test_mul_by_30: 1536 ; X64-JAG: # %bb.0: 1537 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 1538 ; X64-JAG-NEXT: shll $5, %eax # sched: [1:0.50] 1539 ; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50] 1540 ; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50] 1541 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1542 ; 1543 ; X86-NOOPT-LABEL: test_mul_by_30: 1544 ; X86-NOOPT: # %bb.0: 1545 ; X86-NOOPT-NEXT: imull $30, {{[0-9]+}}(%esp), %eax 1546 ; X86-NOOPT-NEXT: retl 1547 ; 1548 ; HSW-NOOPT-LABEL: test_mul_by_30: 1549 ; HSW-NOOPT: # %bb.0: 1550 ; HSW-NOOPT-NEXT: imull $30, %edi, %eax # sched: [3:1.00] 1551 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1552 ; 1553 ; JAG-NOOPT-LABEL: test_mul_by_30: 1554 ; JAG-NOOPT: # %bb.0: 1555 ; JAG-NOOPT-NEXT: imull $30, %edi, %eax # sched: [3:1.00] 1556 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1557 ; 1558 ; X64-SLM-LABEL: test_mul_by_30: 1559 ; X64-SLM: # %bb.0: 1560 ; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50] 1561 ; X64-SLM-NEXT: shll $5, %eax # sched: [1:1.00] 1562 ; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50] 1563 ; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50] 1564 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1565 ; 1566 ; SLM-NOOPT-LABEL: test_mul_by_30: 1567 ; SLM-NOOPT: # %bb.0: 1568 ; SLM-NOOPT-NEXT: imull $30, %edi, %eax # sched: [3:1.00] 1569 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1570 %mul = mul nsw i32 %x, 30 1571 ret i32 %mul 1572 } 1573 1574 define i32 @test_mul_by_31(i32 %x) { 1575 ; X86-LABEL: test_mul_by_31: 1576 ; X86: # %bb.0: 1577 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1578 ; X86-NEXT: movl %ecx, %eax 1579 ; X86-NEXT: shll $5, %eax 1580 ; X86-NEXT: subl %ecx, %eax 1581 ; X86-NEXT: retl 1582 ; 1583 ; X64-HSW-LABEL: test_mul_by_31: 1584 ; X64-HSW: # %bb.0: 1585 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 1586 ; X64-HSW-NEXT: shll $5, %eax # sched: [1:0.50] 1587 ; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25] 1588 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1589 ; 1590 ; X64-JAG-LABEL: test_mul_by_31: 1591 ; X64-JAG: # %bb.0: 1592 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 1593 ; X64-JAG-NEXT: shll $5, %eax # sched: [1:0.50] 1594 ; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50] 1595 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1596 ; 1597 ; X86-NOOPT-LABEL: test_mul_by_31: 1598 ; X86-NOOPT: # %bb.0: 1599 ; X86-NOOPT-NEXT: imull $31, {{[0-9]+}}(%esp), %eax 1600 ; X86-NOOPT-NEXT: retl 1601 ; 1602 ; HSW-NOOPT-LABEL: test_mul_by_31: 1603 ; HSW-NOOPT: # %bb.0: 1604 ; HSW-NOOPT-NEXT: imull $31, %edi, %eax # sched: [3:1.00] 1605 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1606 ; 1607 ; JAG-NOOPT-LABEL: test_mul_by_31: 1608 ; JAG-NOOPT: # %bb.0: 1609 ; JAG-NOOPT-NEXT: imull $31, %edi, %eax # sched: [3:1.00] 1610 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1611 ; 1612 ; X64-SLM-LABEL: test_mul_by_31: 1613 ; X64-SLM: # %bb.0: 1614 ; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50] 1615 ; X64-SLM-NEXT: shll $5, %eax # sched: [1:1.00] 1616 ; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50] 1617 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1618 ; 1619 ; SLM-NOOPT-LABEL: test_mul_by_31: 1620 ; SLM-NOOPT: # %bb.0: 1621 ; SLM-NOOPT-NEXT: imull $31, %edi, %eax # sched: [3:1.00] 1622 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1623 %mul = mul nsw i32 %x, 31 1624 ret i32 %mul 1625 } 1626 1627 define i32 @test_mul_by_32(i32 %x) { 1628 ; X86-LABEL: test_mul_by_32: 1629 ; X86: # %bb.0: 1630 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1631 ; X86-NEXT: shll $5, %eax 1632 ; X86-NEXT: retl 1633 ; 1634 ; X64-HSW-LABEL: test_mul_by_32: 1635 ; X64-HSW: # %bb.0: 1636 ; X64-HSW-NEXT: shll $5, %edi # sched: [1:0.50] 1637 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 1638 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1639 ; 1640 ; X64-JAG-LABEL: test_mul_by_32: 1641 ; X64-JAG: # %bb.0: 1642 ; X64-JAG-NEXT: shll $5, %edi # sched: [1:0.50] 1643 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 1644 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1645 ; 1646 ; X86-NOOPT-LABEL: test_mul_by_32: 1647 ; X86-NOOPT: # %bb.0: 1648 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 1649 ; X86-NOOPT-NEXT: shll $5, %eax 1650 ; X86-NOOPT-NEXT: retl 1651 ; 1652 ; HSW-NOOPT-LABEL: test_mul_by_32: 1653 ; HSW-NOOPT: # %bb.0: 1654 ; HSW-NOOPT-NEXT: shll $5, %edi # sched: [1:0.50] 1655 ; HSW-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.25] 1656 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1657 ; 1658 ; JAG-NOOPT-LABEL: test_mul_by_32: 1659 ; JAG-NOOPT: # %bb.0: 1660 ; JAG-NOOPT-NEXT: shll $5, %edi # sched: [1:0.50] 1661 ; JAG-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.50] 1662 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1663 ; 1664 ; X64-SLM-LABEL: test_mul_by_32: 1665 ; X64-SLM: # %bb.0: 1666 ; X64-SLM-NEXT: shll $5, %edi # sched: [1:1.00] 1667 ; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50] 1668 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1669 ; 1670 ; SLM-NOOPT-LABEL: test_mul_by_32: 1671 ; SLM-NOOPT: # %bb.0: 1672 ; SLM-NOOPT-NEXT: shll $5, %edi # sched: [1:1.00] 1673 ; SLM-NOOPT-NEXT: movl %edi, %eax # sched: [1:0.50] 1674 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1675 %mul = mul nsw i32 %x, 32 1676 ret i32 %mul 1677 } 1678 1679 define i32 @test_mul_by_37(i32 %x) { 1680 ; X86-LABEL: test_mul_by_37: 1681 ; X86: # %bb.0: 1682 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1683 ; X86-NEXT: leal (%eax,%eax,8), %ecx 1684 ; X86-NEXT: leal (%eax,%ecx,4), %eax 1685 ; X86-NEXT: retl 1686 ; 1687 ; X64-HSW-LABEL: test_mul_by_37: 1688 ; X64-HSW: # %bb.0: 1689 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1690 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 1691 ; X64-HSW-NEXT: leal (%rdi,%rax,4), %eax # sched: [1:0.50] 1692 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1693 ; 1694 ; X64-JAG-LABEL: test_mul_by_37: 1695 ; X64-JAG: # %bb.0: 1696 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1697 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 1698 ; X64-JAG-NEXT: leal (%rdi,%rax,4), %eax # sched: [2:1.00] 1699 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1700 ; 1701 ; X86-NOOPT-LABEL: test_mul_by_37: 1702 ; X86-NOOPT: # %bb.0: 1703 ; X86-NOOPT-NEXT: imull $37, {{[0-9]+}}(%esp), %eax 1704 ; X86-NOOPT-NEXT: retl 1705 ; 1706 ; HSW-NOOPT-LABEL: test_mul_by_37: 1707 ; HSW-NOOPT: # %bb.0: 1708 ; HSW-NOOPT-NEXT: imull $37, %edi, %eax # sched: [3:1.00] 1709 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1710 ; 1711 ; JAG-NOOPT-LABEL: test_mul_by_37: 1712 ; JAG-NOOPT: # %bb.0: 1713 ; JAG-NOOPT-NEXT: imull $37, %edi, %eax # sched: [3:1.00] 1714 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1715 ; 1716 ; X64-SLM-LABEL: test_mul_by_37: 1717 ; X64-SLM: # %bb.0: 1718 ; X64-SLM-NEXT: imull $37, %edi, %eax # sched: [3:1.00] 1719 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1720 ; 1721 ; SLM-NOOPT-LABEL: test_mul_by_37: 1722 ; SLM-NOOPT: # %bb.0: 1723 ; SLM-NOOPT-NEXT: imull $37, %edi, %eax # sched: [3:1.00] 1724 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1725 %mul = mul nsw i32 %x, 37 1726 ret i32 %mul 1727 } 1728 1729 define i32 @test_mul_by_41(i32 %x) { 1730 ; X86-LABEL: test_mul_by_41: 1731 ; X86: # %bb.0: 1732 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1733 ; X86-NEXT: leal (%eax,%eax,4), %ecx 1734 ; X86-NEXT: leal (%eax,%ecx,8), %eax 1735 ; X86-NEXT: retl 1736 ; 1737 ; X64-HSW-LABEL: test_mul_by_41: 1738 ; X64-HSW: # %bb.0: 1739 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1740 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 1741 ; X64-HSW-NEXT: leal (%rdi,%rax,8), %eax # sched: [1:0.50] 1742 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1743 ; 1744 ; X64-JAG-LABEL: test_mul_by_41: 1745 ; X64-JAG: # %bb.0: 1746 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1747 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 1748 ; X64-JAG-NEXT: leal (%rdi,%rax,8), %eax # sched: [2:1.00] 1749 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1750 ; 1751 ; X86-NOOPT-LABEL: test_mul_by_41: 1752 ; X86-NOOPT: # %bb.0: 1753 ; X86-NOOPT-NEXT: imull $41, {{[0-9]+}}(%esp), %eax 1754 ; X86-NOOPT-NEXT: retl 1755 ; 1756 ; HSW-NOOPT-LABEL: test_mul_by_41: 1757 ; HSW-NOOPT: # %bb.0: 1758 ; HSW-NOOPT-NEXT: imull $41, %edi, %eax # sched: [3:1.00] 1759 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1760 ; 1761 ; JAG-NOOPT-LABEL: test_mul_by_41: 1762 ; JAG-NOOPT: # %bb.0: 1763 ; JAG-NOOPT-NEXT: imull $41, %edi, %eax # sched: [3:1.00] 1764 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1765 ; 1766 ; X64-SLM-LABEL: test_mul_by_41: 1767 ; X64-SLM: # %bb.0: 1768 ; X64-SLM-NEXT: imull $41, %edi, %eax # sched: [3:1.00] 1769 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1770 ; 1771 ; SLM-NOOPT-LABEL: test_mul_by_41: 1772 ; SLM-NOOPT: # %bb.0: 1773 ; SLM-NOOPT-NEXT: imull $41, %edi, %eax # sched: [3:1.00] 1774 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1775 %mul = mul nsw i32 %x, 41 1776 ret i32 %mul 1777 } 1778 1779 define i32 @test_mul_by_62(i32 %x) { 1780 ; X86-LABEL: test_mul_by_62: 1781 ; X86: # %bb.0: 1782 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 1783 ; X86-NEXT: movl %ecx, %eax 1784 ; X86-NEXT: shll $6, %eax 1785 ; X86-NEXT: subl %ecx, %eax 1786 ; X86-NEXT: subl %ecx, %eax 1787 ; X86-NEXT: retl 1788 ; 1789 ; X64-HSW-LABEL: test_mul_by_62: 1790 ; X64-HSW: # %bb.0: 1791 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 1792 ; X64-HSW-NEXT: shll $6, %eax # sched: [1:0.50] 1793 ; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25] 1794 ; X64-HSW-NEXT: subl %edi, %eax # sched: [1:0.25] 1795 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1796 ; 1797 ; X64-JAG-LABEL: test_mul_by_62: 1798 ; X64-JAG: # %bb.0: 1799 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 1800 ; X64-JAG-NEXT: shll $6, %eax # sched: [1:0.50] 1801 ; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50] 1802 ; X64-JAG-NEXT: subl %edi, %eax # sched: [1:0.50] 1803 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1804 ; 1805 ; X86-NOOPT-LABEL: test_mul_by_62: 1806 ; X86-NOOPT: # %bb.0: 1807 ; X86-NOOPT-NEXT: imull $62, {{[0-9]+}}(%esp), %eax 1808 ; X86-NOOPT-NEXT: retl 1809 ; 1810 ; HSW-NOOPT-LABEL: test_mul_by_62: 1811 ; HSW-NOOPT: # %bb.0: 1812 ; HSW-NOOPT-NEXT: imull $62, %edi, %eax # sched: [3:1.00] 1813 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1814 ; 1815 ; JAG-NOOPT-LABEL: test_mul_by_62: 1816 ; JAG-NOOPT: # %bb.0: 1817 ; JAG-NOOPT-NEXT: imull $62, %edi, %eax # sched: [3:1.00] 1818 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1819 ; 1820 ; X64-SLM-LABEL: test_mul_by_62: 1821 ; X64-SLM: # %bb.0: 1822 ; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50] 1823 ; X64-SLM-NEXT: shll $6, %eax # sched: [1:1.00] 1824 ; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50] 1825 ; X64-SLM-NEXT: subl %edi, %eax # sched: [1:0.50] 1826 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1827 ; 1828 ; SLM-NOOPT-LABEL: test_mul_by_62: 1829 ; SLM-NOOPT: # %bb.0: 1830 ; SLM-NOOPT-NEXT: imull $62, %edi, %eax # sched: [3:1.00] 1831 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1832 %mul = mul nsw i32 %x, 62 1833 ret i32 %mul 1834 } 1835 1836 define i32 @test_mul_by_66(i32 %x) { 1837 ; X86-LABEL: test_mul_by_66: 1838 ; X86: # %bb.0: 1839 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1840 ; X86-NEXT: movl %eax, %ecx 1841 ; X86-NEXT: shll $6, %ecx 1842 ; X86-NEXT: leal (%ecx,%eax,2), %eax 1843 ; X86-NEXT: retl 1844 ; 1845 ; X64-HSW-LABEL: test_mul_by_66: 1846 ; X64-HSW: # %bb.0: 1847 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1848 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 1849 ; X64-HSW-NEXT: shll $6, %eax # sched: [1:0.50] 1850 ; X64-HSW-NEXT: leal (%rax,%rdi,2), %eax # sched: [1:0.50] 1851 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1852 ; 1853 ; X64-JAG-LABEL: test_mul_by_66: 1854 ; X64-JAG: # %bb.0: 1855 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1856 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 1857 ; X64-JAG-NEXT: shll $6, %eax # sched: [1:0.50] 1858 ; X64-JAG-NEXT: leal (%rax,%rdi,2), %eax # sched: [2:1.00] 1859 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1860 ; 1861 ; X86-NOOPT-LABEL: test_mul_by_66: 1862 ; X86-NOOPT: # %bb.0: 1863 ; X86-NOOPT-NEXT: imull $66, {{[0-9]+}}(%esp), %eax 1864 ; X86-NOOPT-NEXT: retl 1865 ; 1866 ; HSW-NOOPT-LABEL: test_mul_by_66: 1867 ; HSW-NOOPT: # %bb.0: 1868 ; HSW-NOOPT-NEXT: imull $66, %edi, %eax # sched: [3:1.00] 1869 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1870 ; 1871 ; JAG-NOOPT-LABEL: test_mul_by_66: 1872 ; JAG-NOOPT: # %bb.0: 1873 ; JAG-NOOPT-NEXT: imull $66, %edi, %eax # sched: [3:1.00] 1874 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1875 ; 1876 ; X64-SLM-LABEL: test_mul_by_66: 1877 ; X64-SLM: # %bb.0: 1878 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 1879 ; X64-SLM-NEXT: movl %edi, %eax # sched: [1:0.50] 1880 ; X64-SLM-NEXT: shll $6, %eax # sched: [1:1.00] 1881 ; X64-SLM-NEXT: leal (%rax,%rdi), %eax # sched: [1:1.00] 1882 ; X64-SLM-NEXT: addl %edi, %eax # sched: [1:0.50] 1883 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1884 ; 1885 ; SLM-NOOPT-LABEL: test_mul_by_66: 1886 ; SLM-NOOPT: # %bb.0: 1887 ; SLM-NOOPT-NEXT: imull $66, %edi, %eax # sched: [3:1.00] 1888 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1889 %mul = mul nsw i32 %x, 66 1890 ret i32 %mul 1891 } 1892 1893 define i32 @test_mul_by_73(i32 %x) { 1894 ; X86-LABEL: test_mul_by_73: 1895 ; X86: # %bb.0: 1896 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1897 ; X86-NEXT: leal (%eax,%eax,8), %ecx 1898 ; X86-NEXT: leal (%eax,%ecx,8), %eax 1899 ; X86-NEXT: retl 1900 ; 1901 ; X64-HSW-LABEL: test_mul_by_73: 1902 ; X64-HSW: # %bb.0: 1903 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1904 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 1905 ; X64-HSW-NEXT: leal (%rdi,%rax,8), %eax # sched: [1:0.50] 1906 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1907 ; 1908 ; X64-JAG-LABEL: test_mul_by_73: 1909 ; X64-JAG: # %bb.0: 1910 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1911 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 1912 ; X64-JAG-NEXT: leal (%rdi,%rax,8), %eax # sched: [2:1.00] 1913 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1914 ; 1915 ; X86-NOOPT-LABEL: test_mul_by_73: 1916 ; X86-NOOPT: # %bb.0: 1917 ; X86-NOOPT-NEXT: imull $73, {{[0-9]+}}(%esp), %eax 1918 ; X86-NOOPT-NEXT: retl 1919 ; 1920 ; HSW-NOOPT-LABEL: test_mul_by_73: 1921 ; HSW-NOOPT: # %bb.0: 1922 ; HSW-NOOPT-NEXT: imull $73, %edi, %eax # sched: [3:1.00] 1923 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1924 ; 1925 ; JAG-NOOPT-LABEL: test_mul_by_73: 1926 ; JAG-NOOPT: # %bb.0: 1927 ; JAG-NOOPT-NEXT: imull $73, %edi, %eax # sched: [3:1.00] 1928 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1929 ; 1930 ; X64-SLM-LABEL: test_mul_by_73: 1931 ; X64-SLM: # %bb.0: 1932 ; X64-SLM-NEXT: imull $73, %edi, %eax # sched: [3:1.00] 1933 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1934 ; 1935 ; SLM-NOOPT-LABEL: test_mul_by_73: 1936 ; SLM-NOOPT: # %bb.0: 1937 ; SLM-NOOPT-NEXT: imull $73, %edi, %eax # sched: [3:1.00] 1938 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1939 %mul = mul nsw i32 %x, 73 1940 ret i32 %mul 1941 } 1942 1943 define i32 @test_mul_by_520(i32 %x) { 1944 ; X86-LABEL: test_mul_by_520: 1945 ; X86: # %bb.0: 1946 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 1947 ; X86-NEXT: movl %eax, %ecx 1948 ; X86-NEXT: shll $9, %ecx 1949 ; X86-NEXT: leal (%ecx,%eax,8), %eax 1950 ; X86-NEXT: retl 1951 ; 1952 ; X64-HSW-LABEL: test_mul_by_520: 1953 ; X64-HSW: # %bb.0: 1954 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 1955 ; X64-HSW-NEXT: movl %edi, %eax # sched: [1:0.25] 1956 ; X64-HSW-NEXT: shll $9, %eax # sched: [1:0.50] 1957 ; X64-HSW-NEXT: leal (%rax,%rdi,8), %eax # sched: [1:0.50] 1958 ; X64-HSW-NEXT: retq # sched: [7:1.00] 1959 ; 1960 ; X64-JAG-LABEL: test_mul_by_520: 1961 ; X64-JAG: # %bb.0: 1962 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 1963 ; X64-JAG-NEXT: movl %edi, %eax # sched: [1:0.50] 1964 ; X64-JAG-NEXT: shll $9, %eax # sched: [1:0.50] 1965 ; X64-JAG-NEXT: leal (%rax,%rdi,8), %eax # sched: [2:1.00] 1966 ; X64-JAG-NEXT: retq # sched: [4:1.00] 1967 ; 1968 ; X86-NOOPT-LABEL: test_mul_by_520: 1969 ; X86-NOOPT: # %bb.0: 1970 ; X86-NOOPT-NEXT: imull $520, {{[0-9]+}}(%esp), %eax # imm = 0x208 1971 ; X86-NOOPT-NEXT: retl 1972 ; 1973 ; HSW-NOOPT-LABEL: test_mul_by_520: 1974 ; HSW-NOOPT: # %bb.0: 1975 ; HSW-NOOPT-NEXT: imull $520, %edi, %eax # imm = 0x208 1976 ; HSW-NOOPT-NEXT: # sched: [3:1.00] 1977 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 1978 ; 1979 ; JAG-NOOPT-LABEL: test_mul_by_520: 1980 ; JAG-NOOPT: # %bb.0: 1981 ; JAG-NOOPT-NEXT: imull $520, %edi, %eax # imm = 0x208 1982 ; JAG-NOOPT-NEXT: # sched: [3:1.00] 1983 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 1984 ; 1985 ; X64-SLM-LABEL: test_mul_by_520: 1986 ; X64-SLM: # %bb.0: 1987 ; X64-SLM-NEXT: imull $520, %edi, %eax # imm = 0x208 1988 ; X64-SLM-NEXT: # sched: [3:1.00] 1989 ; X64-SLM-NEXT: retq # sched: [4:1.00] 1990 ; 1991 ; SLM-NOOPT-LABEL: test_mul_by_520: 1992 ; SLM-NOOPT: # %bb.0: 1993 ; SLM-NOOPT-NEXT: imull $520, %edi, %eax # imm = 0x208 1994 ; SLM-NOOPT-NEXT: # sched: [3:1.00] 1995 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 1996 %mul = mul nsw i32 %x, 520 1997 ret i32 %mul 1998 } 1999 2000 define i32 @test_mul_by_neg10(i32 %x) { 2001 ; X86-LABEL: test_mul_by_neg10: 2002 ; X86: # %bb.0: 2003 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 2004 ; X86-NEXT: addl %eax, %eax 2005 ; X86-NEXT: leal (%eax,%eax,4), %eax 2006 ; X86-NEXT: negl %eax 2007 ; X86-NEXT: retl 2008 ; 2009 ; X64-HSW-LABEL: test_mul_by_neg10: 2010 ; X64-HSW: # %bb.0: 2011 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 2012 ; X64-HSW-NEXT: addl %edi, %edi # sched: [1:0.25] 2013 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 2014 ; X64-HSW-NEXT: negl %eax # sched: [1:0.25] 2015 ; X64-HSW-NEXT: retq # sched: [7:1.00] 2016 ; 2017 ; X64-JAG-LABEL: test_mul_by_neg10: 2018 ; X64-JAG: # %bb.0: 2019 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 2020 ; X64-JAG-NEXT: addl %edi, %edi # sched: [1:0.50] 2021 ; X64-JAG-NEXT: leal (%rdi,%rdi,4), %eax # sched: [2:1.00] 2022 ; X64-JAG-NEXT: negl %eax # sched: [1:0.50] 2023 ; X64-JAG-NEXT: retq # sched: [4:1.00] 2024 ; 2025 ; X86-NOOPT-LABEL: test_mul_by_neg10: 2026 ; X86-NOOPT: # %bb.0: 2027 ; X86-NOOPT-NEXT: imull $-10, {{[0-9]+}}(%esp), %eax 2028 ; X86-NOOPT-NEXT: retl 2029 ; 2030 ; HSW-NOOPT-LABEL: test_mul_by_neg10: 2031 ; HSW-NOOPT: # %bb.0: 2032 ; HSW-NOOPT-NEXT: imull $-10, %edi, %eax # sched: [3:1.00] 2033 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 2034 ; 2035 ; JAG-NOOPT-LABEL: test_mul_by_neg10: 2036 ; JAG-NOOPT: # %bb.0: 2037 ; JAG-NOOPT-NEXT: imull $-10, %edi, %eax # sched: [3:1.00] 2038 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 2039 ; 2040 ; X64-SLM-LABEL: test_mul_by_neg10: 2041 ; X64-SLM: # %bb.0: 2042 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 2043 ; X64-SLM-NEXT: addl %edi, %edi # sched: [1:0.50] 2044 ; X64-SLM-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:1.00] 2045 ; X64-SLM-NEXT: negl %eax # sched: [1:0.50] 2046 ; X64-SLM-NEXT: retq # sched: [4:1.00] 2047 ; 2048 ; SLM-NOOPT-LABEL: test_mul_by_neg10: 2049 ; SLM-NOOPT: # %bb.0: 2050 ; SLM-NOOPT-NEXT: imull $-10, %edi, %eax # sched: [3:1.00] 2051 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 2052 %mul = mul nsw i32 %x, -10 2053 ret i32 %mul 2054 } 2055 2056 define i32 @test_mul_by_neg36(i32 %x) { 2057 ; X86-LABEL: test_mul_by_neg36: 2058 ; X86: # %bb.0: 2059 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 2060 ; X86-NEXT: shll $2, %eax 2061 ; X86-NEXT: leal (%eax,%eax,8), %eax 2062 ; X86-NEXT: negl %eax 2063 ; X86-NEXT: retl 2064 ; 2065 ; X64-HSW-LABEL: test_mul_by_neg36: 2066 ; X64-HSW: # %bb.0: 2067 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 2068 ; X64-HSW-NEXT: shll $2, %edi # sched: [1:0.50] 2069 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 2070 ; X64-HSW-NEXT: negl %eax # sched: [1:0.25] 2071 ; X64-HSW-NEXT: retq # sched: [7:1.00] 2072 ; 2073 ; X64-JAG-LABEL: test_mul_by_neg36: 2074 ; X64-JAG: # %bb.0: 2075 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 2076 ; X64-JAG-NEXT: shll $2, %edi # sched: [1:0.50] 2077 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 2078 ; X64-JAG-NEXT: negl %eax # sched: [1:0.50] 2079 ; X64-JAG-NEXT: retq # sched: [4:1.00] 2080 ; 2081 ; X86-NOOPT-LABEL: test_mul_by_neg36: 2082 ; X86-NOOPT: # %bb.0: 2083 ; X86-NOOPT-NEXT: imull $-36, {{[0-9]+}}(%esp), %eax 2084 ; X86-NOOPT-NEXT: retl 2085 ; 2086 ; HSW-NOOPT-LABEL: test_mul_by_neg36: 2087 ; HSW-NOOPT: # %bb.0: 2088 ; HSW-NOOPT-NEXT: imull $-36, %edi, %eax # sched: [3:1.00] 2089 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 2090 ; 2091 ; JAG-NOOPT-LABEL: test_mul_by_neg36: 2092 ; JAG-NOOPT: # %bb.0: 2093 ; JAG-NOOPT-NEXT: imull $-36, %edi, %eax # sched: [3:1.00] 2094 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 2095 ; 2096 ; X64-SLM-LABEL: test_mul_by_neg36: 2097 ; X64-SLM: # %bb.0: 2098 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 2099 ; X64-SLM-NEXT: shll $2, %edi # sched: [1:1.00] 2100 ; X64-SLM-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00] 2101 ; X64-SLM-NEXT: negl %eax # sched: [1:0.50] 2102 ; X64-SLM-NEXT: retq # sched: [4:1.00] 2103 ; 2104 ; SLM-NOOPT-LABEL: test_mul_by_neg36: 2105 ; SLM-NOOPT: # %bb.0: 2106 ; SLM-NOOPT-NEXT: imull $-36, %edi, %eax # sched: [3:1.00] 2107 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 2108 %mul = mul nsw i32 %x, -36 2109 ret i32 %mul 2110 } 2111 2112 ; (x*9+42)*(x*5+2) 2113 define i32 @test_mul_spec(i32 %x) nounwind { 2114 ; X86-LABEL: test_mul_spec: 2115 ; X86: # %bb.0: 2116 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 2117 ; X86-NEXT: leal 42(%eax,%eax,8), %ecx 2118 ; X86-NEXT: leal 2(%eax,%eax,4), %eax 2119 ; X86-NEXT: imull %ecx, %eax 2120 ; X86-NEXT: retl 2121 ; 2122 ; X64-HSW-LABEL: test_mul_spec: 2123 ; X64-HSW: # %bb.0: 2124 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 2125 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %ecx # sched: [1:0.50] 2126 ; X64-HSW-NEXT: addl $42, %ecx # sched: [1:0.25] 2127 ; X64-HSW-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 2128 ; X64-HSW-NEXT: addl $2, %eax # sched: [1:0.25] 2129 ; X64-HSW-NEXT: imull %ecx, %eax # sched: [3:1.00] 2130 ; X64-HSW-NEXT: retq # sched: [7:1.00] 2131 ; 2132 ; X64-JAG-LABEL: test_mul_spec: 2133 ; X64-JAG: # %bb.0: 2134 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 2135 ; X64-JAG-NEXT: leal 42(%rdi,%rdi,8), %ecx # sched: [2:1.00] 2136 ; X64-JAG-NEXT: leal 2(%rdi,%rdi,4), %eax # sched: [2:1.00] 2137 ; X64-JAG-NEXT: imull %ecx, %eax # sched: [3:1.00] 2138 ; X64-JAG-NEXT: retq # sched: [4:1.00] 2139 ; 2140 ; X86-NOOPT-LABEL: test_mul_spec: 2141 ; X86-NOOPT: # %bb.0: 2142 ; X86-NOOPT-NEXT: movl {{[0-9]+}}(%esp), %eax 2143 ; X86-NOOPT-NEXT: leal 42(%eax,%eax,8), %ecx 2144 ; X86-NOOPT-NEXT: leal 2(%eax,%eax,4), %eax 2145 ; X86-NOOPT-NEXT: imull %ecx, %eax 2146 ; X86-NOOPT-NEXT: retl 2147 ; 2148 ; HSW-NOOPT-LABEL: test_mul_spec: 2149 ; HSW-NOOPT: # %bb.0: 2150 ; HSW-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 2151 ; HSW-NOOPT-NEXT: leal (%rdi,%rdi,8), %ecx # sched: [1:0.50] 2152 ; HSW-NOOPT-NEXT: addl $42, %ecx # sched: [1:0.25] 2153 ; HSW-NOOPT-NEXT: leal (%rdi,%rdi,4), %eax # sched: [1:0.50] 2154 ; HSW-NOOPT-NEXT: addl $2, %eax # sched: [1:0.25] 2155 ; HSW-NOOPT-NEXT: imull %ecx, %eax # sched: [3:1.00] 2156 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 2157 ; 2158 ; JAG-NOOPT-LABEL: test_mul_spec: 2159 ; JAG-NOOPT: # %bb.0: 2160 ; JAG-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 2161 ; JAG-NOOPT-NEXT: leal 42(%rdi,%rdi,8), %ecx # sched: [2:1.00] 2162 ; JAG-NOOPT-NEXT: leal 2(%rdi,%rdi,4), %eax # sched: [2:1.00] 2163 ; JAG-NOOPT-NEXT: imull %ecx, %eax # sched: [3:1.00] 2164 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 2165 ; 2166 ; X64-SLM-LABEL: test_mul_spec: 2167 ; X64-SLM: # %bb.0: 2168 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 2169 ; X64-SLM-NEXT: leal 42(%rdi,%rdi,8), %ecx # sched: [1:1.00] 2170 ; X64-SLM-NEXT: leal 2(%rdi,%rdi,4), %eax # sched: [1:1.00] 2171 ; X64-SLM-NEXT: imull %ecx, %eax # sched: [3:1.00] 2172 ; X64-SLM-NEXT: retq # sched: [4:1.00] 2173 ; 2174 ; SLM-NOOPT-LABEL: test_mul_spec: 2175 ; SLM-NOOPT: # %bb.0: 2176 ; SLM-NOOPT-NEXT: # kill: def $edi killed $edi def $rdi 2177 ; SLM-NOOPT-NEXT: leal 42(%rdi,%rdi,8), %ecx # sched: [1:1.00] 2178 ; SLM-NOOPT-NEXT: leal 2(%rdi,%rdi,4), %eax # sched: [1:1.00] 2179 ; SLM-NOOPT-NEXT: imull %ecx, %eax # sched: [3:1.00] 2180 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 2181 %mul = mul nsw i32 %x, 9 2182 %add = add nsw i32 %mul, 42 2183 %mul2 = mul nsw i32 %x, 5 2184 %add2 = add nsw i32 %mul2, 2 2185 %mul3 = mul nsw i32 %add, %add2 2186 ret i32 %mul3 2187 } 2188 2189 ; This makes sure we are able to fold the negate generated by the mul expansion 2190 ; into the next instruction. 2191 ; FIXME: We make this work. 2192 define i32 @mul_neg_fold(i32 %a, i32 %b) { 2193 ; X86-LABEL: mul_neg_fold: 2194 ; X86: # %bb.0: 2195 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 2196 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 2197 ; X86-NEXT: leal (%ecx,%ecx,8), %ecx 2198 ; X86-NEXT: subl %ecx, %eax 2199 ; X86-NEXT: retl 2200 ; 2201 ; X64-HSW-LABEL: mul_neg_fold: 2202 ; X64-HSW: # %bb.0: 2203 ; X64-HSW-NEXT: # kill: def $edi killed $edi def $rdi 2204 ; X64-HSW-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:0.50] 2205 ; X64-HSW-NEXT: subl %eax, %esi # sched: [1:0.25] 2206 ; X64-HSW-NEXT: movl %esi, %eax # sched: [1:0.25] 2207 ; X64-HSW-NEXT: retq # sched: [7:1.00] 2208 ; 2209 ; X64-JAG-LABEL: mul_neg_fold: 2210 ; X64-JAG: # %bb.0: 2211 ; X64-JAG-NEXT: # kill: def $edi killed $edi def $rdi 2212 ; X64-JAG-NEXT: leal (%rdi,%rdi,8), %eax # sched: [2:1.00] 2213 ; X64-JAG-NEXT: subl %eax, %esi # sched: [1:0.50] 2214 ; X64-JAG-NEXT: movl %esi, %eax # sched: [1:0.50] 2215 ; X64-JAG-NEXT: retq # sched: [4:1.00] 2216 ; 2217 ; X86-NOOPT-LABEL: mul_neg_fold: 2218 ; X86-NOOPT: # %bb.0: 2219 ; X86-NOOPT-NEXT: imull $-9, {{[0-9]+}}(%esp), %eax 2220 ; X86-NOOPT-NEXT: addl {{[0-9]+}}(%esp), %eax 2221 ; X86-NOOPT-NEXT: retl 2222 ; 2223 ; HSW-NOOPT-LABEL: mul_neg_fold: 2224 ; HSW-NOOPT: # %bb.0: 2225 ; HSW-NOOPT-NEXT: imull $-9, %edi, %eax # sched: [3:1.00] 2226 ; HSW-NOOPT-NEXT: addl %esi, %eax # sched: [1:0.25] 2227 ; HSW-NOOPT-NEXT: retq # sched: [7:1.00] 2228 ; 2229 ; JAG-NOOPT-LABEL: mul_neg_fold: 2230 ; JAG-NOOPT: # %bb.0: 2231 ; JAG-NOOPT-NEXT: imull $-9, %edi, %eax # sched: [3:1.00] 2232 ; JAG-NOOPT-NEXT: addl %esi, %eax # sched: [1:0.50] 2233 ; JAG-NOOPT-NEXT: retq # sched: [4:1.00] 2234 ; 2235 ; X64-SLM-LABEL: mul_neg_fold: 2236 ; X64-SLM: # %bb.0: 2237 ; X64-SLM-NEXT: # kill: def $edi killed $edi def $rdi 2238 ; X64-SLM-NEXT: leal (%rdi,%rdi,8), %eax # sched: [1:1.00] 2239 ; X64-SLM-NEXT: subl %eax, %esi # sched: [1:0.50] 2240 ; X64-SLM-NEXT: movl %esi, %eax # sched: [1:0.50] 2241 ; X64-SLM-NEXT: retq # sched: [4:1.00] 2242 ; 2243 ; SLM-NOOPT-LABEL: mul_neg_fold: 2244 ; SLM-NOOPT: # %bb.0: 2245 ; SLM-NOOPT-NEXT: imull $-9, %edi, %eax # sched: [3:1.00] 2246 ; SLM-NOOPT-NEXT: addl %esi, %eax # sched: [1:0.50] 2247 ; SLM-NOOPT-NEXT: retq # sched: [4:1.00] 2248 %c = mul i32 %a, -9 2249 %d = add i32 %b, %c 2250 ret i32 %d 2251 } 2252