reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
; RUN: llc -march=hexagon < %s | FileCheck %s

target triple = "hexagon-unknown--elf"

; CHECK-LABEL: mul_1
; CHECK: r1:0 = mpy(r2,r0)
define i64 @mul_1(i64 %a0, i64 %a1) #0 {
b2:
  %v3 = shl i64 %a0, 32
  %v4 = ashr exact i64 %v3, 32
  %v5 = shl i64 %a1, 32
  %v6 = ashr exact i64 %v5, 32
  %v7 = mul nsw i64 %v6, %v4
  ret i64 %v7
}

; CHECK-LABEL: mul_2
; CHECK: r0 = memb(r0+#0)
; CHECK: r1:0 = mpy(r2,r0)
; CHECK: jumpr r31
define i64 @mul_2(i8* %a0, i64 %a1) #0 {
b2:
  %v3 = load i8, i8* %a0
  %v4 = sext i8 %v3 to i64
  %v5 = shl i64 %a1, 32
  %v6 = ashr exact i64 %v5, 32
  %v7 = mul nsw i64 %v6, %v4
  ret i64 %v7
}

; CHECK-LABEL: mul_3
; CHECK: r[[REG30:[0-9]+]] = sxth(r2)
; CHECK: r1:0 = mpy(r[[REG30]],r0)
; CHECK: jumpr r31
define i64 @mul_3(i64 %a0, i64 %a1) #0 {
b2:
  %v3 = shl i64 %a0, 32
  %v4 = ashr exact i64 %v3, 32
  %v5 = shl i64 %a1, 48
  %v6 = ashr exact i64 %v5, 48
  %v7 = mul nsw i64 %v6, %v4
  ret i64 %v7
}

; CHECK-LABEL: mul_4
; CHECK: r[[REG40:[0-9]+]] = asrh(r2)
; CHECK: r1:0 = mpy(r1,r[[REG40]])
; CHECK: jumpr r31
define i64 @mul_4(i64 %a0, i64 %a1) #0 {
b2:
  %v3 = ashr i64 %a0, 32
  %v4 = trunc i64 %a1 to i32
  %v5 = ashr i32 %v4, 16
  %v6 = sext i32 %v5 to i64
  %v7 = mul nsw i64 %v3, %v6
  ret i64 %v7
}

; CHECK-LABEL: mul_acc_1
; CHECK: r5:4 += mpy(r2,r0)
; CHECK: r1:0 = combine(r5,r4)
; CHECK: jumpr r31
define i64 @mul_acc_1(i64 %a0, i64 %a1, i64 %a2) #0 {
b3:
  %v4 = shl i64 %a0, 32
  %v5 = ashr exact i64 %v4, 32
  %v6 = shl i64 %a1, 32
  %v7 = ashr exact i64 %v6, 32
  %v8 = mul nsw i64 %v7, %v5
  %v9 = add i64 %a2, %v8
  ret i64 %v9
}

; CHECK-LABEL: mul_acc_2
; CHECK: r2 = memw(r2+#0)
; CHECK: r5:4 += mpy(r2,r0)
; CHECK: r1:0 = combine(r5,r4)
; CHECK: jumpr r31
define i64 @mul_acc_2(i64 %a0, i32* %a1, i64 %a2) #0 {
b3:
  %v4 = shl i64 %a0, 32
  %v5 = ashr exact i64 %v4, 32
  %v6 = load i32, i32* %a1
  %v7 = sext i32 %v6 to i64
  %v8 = mul nsw i64 %v7, %v5
  %v9 = add i64 %a2, %v8
  ret i64 %v9
}

; CHECK-LABEL: mul_nac_1
; CHECK: r5:4 -= mpy(r2,r0)
; CHECK: r1:0 = combine(r5,r4)
; CHECK: jumpr r31
define i64 @mul_nac_1(i64 %a0, i64 %a1, i64 %a2) #0 {
b3:
  %v4 = shl i64 %a0, 32
  %v5 = ashr exact i64 %v4, 32
  %v6 = shl i64 %a1, 32
  %v7 = ashr exact i64 %v6, 32
  %v8 = mul nsw i64 %v7, %v5
  %v9 = sub i64 %a2, %v8
  ret i64 %v9
}

; CHECK-LABEL: mul_nac_2
; CHECK: r1:0 = combine(r5,r4)
; CHECK: r6 = memw(r0+#0)
; CHECK: r1:0 -= mpy(r2,r6)
; CHECK: jumpr r31
define i64 @mul_nac_2(i32* %a0, i64 %a1, i64 %a2) #0 {
b3:
  %v4 = load i32, i32* %a0
  %v5 = sext i32 %v4 to i64
  %v6 = shl i64 %a1, 32
  %v7 = ashr exact i64 %v6, 32
  %v8 = mul nsw i64 %v7, %v5
  %v9 = sub i64 %a2, %v8
  ret i64 %v9
}

attributes #0 = { nounwind }