Home | History | Annotate | Download | only in Mips
      1 ; RUN: llc -march=mipsel < %s | FileCheck %s -check-prefix=CHECK
      2 ; RUN: llc -march=mips64el < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK64
      3 
      4 ; CHECK-LABEL: mul5_32:
      5 ; CHECK: sll $[[R0:[0-9]+]], $4, 2
      6 ; CHECK: addu ${{[0-9]+}}, $[[R0]], $4
      7 
      8 define i32 @mul5_32(i32 %a) {
      9 entry:
     10   %mul = mul nsw i32 %a, 5
     11   ret i32 %mul
     12 }
     13 
     14 ; CHECK-LABEL:     mul27_32:
     15 ; CHECK-DAG: sll $[[R0:[0-9]+]], $4, 2
     16 ; CHECK-DAG: addu $[[R1:[0-9]+]], $[[R0]], $4
     17 ; CHECK-DAG: sll $[[R2:[0-9]+]], $4, 5
     18 ; CHECK:     subu ${{[0-9]+}}, $[[R2]], $[[R1]]
     19 
     20 define i32 @mul27_32(i32 %a) {
     21 entry:
     22   %mul = mul nsw i32 %a, 27
     23   ret i32 %mul
     24 }
     25 
     26 ; CHECK-LABEL:     muln2147483643_32:
     27 ; CHECK-DAG: sll $[[R0:[0-9]+]], $4, 2
     28 ; CHECK-DAG: addu $[[R1:[0-9]+]], $[[R0]], $4
     29 ; CHECK-DAG: sll $[[R2:[0-9]+]], $4, 31
     30 ; CHECK:     addu ${{[0-9]+}}, $[[R2]], $[[R1]]
     31 
     32 define i32 @muln2147483643_32(i32 %a) {
     33 entry:
     34   %mul = mul nsw i32 %a, -2147483643
     35   ret i32 %mul
     36 }
     37 
     38 ; CHECK64-LABEL:     muln9223372036854775805_64:
     39 ; CHECK64-DAG: dsll $[[R0:[0-9]+]], $4, 1
     40 ; CHECK64-DAG: daddu $[[R1:[0-9]+]], $[[R0]], $4
     41 ; CHECK64-DAG: dsll $[[R2:[0-9]+]], $4, 63
     42 ; CHECK64:     daddu ${{[0-9]+}}, $[[R2]], $[[R1]]
     43 
     44 define i64 @muln9223372036854775805_64(i64 %a) {
     45 entry:
     46   %mul = mul nsw i64 %a, -9223372036854775805
     47   ret i64 %mul
     48 }
     49