• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=avr | FileCheck %s
2
3define i1 @signed_multiplication_did_overflow(i8, i8) unnamed_addr {
4; CHECK-LABEL: signed_multiplication_did_overflow:
5entry-block:
6  %2 = tail call { i8, i1 } @llvm.smul.with.overflow.i8(i8 %0, i8 %1)
7  %3 = extractvalue { i8, i1 } %2, 1
8  ret i1 %3
9
10; Multiply, fill the low byte with the sign of the low byte via
11; arithmetic shifting, compare it to the high byte.
12;
13; CHECK: muls   r24, r22
14; CHECK: mov    [[HIGH:r[0-9]+]], r1
15; CHECK: mov    [[LOW:r[0-9]+]], r0
16; CHECK: asr    {{.*}}[[LOW]]
17; CHECK: asr    {{.*}}[[LOW]]
18; CHECK: asr    {{.*}}[[LOW]]
19; CHECK: asr    {{.*}}[[LOW]]
20; CHECK: asr    {{.*}}[[LOW]]
21; CHECK: asr    {{.*}}[[LOW]]
22; CHECK: asr    {{.*}}[[LOW]]
23; CHECK: ldi    [[RET:r[0-9]+]], 1
24; CHECK: cp     {{.*}}[[HIGH]], {{.*}}[[LOW]]
25; CHECK: brne   [[LABEL:LBB[_0-9]+]]
26; CHECK: ldi    {{.*}}[[RET]], 0
27; CHECK: {{.*}}[[LABEL]]
28; CHECK: ret
29}
30
31declare { i8, i1 } @llvm.smul.with.overflow.i8(i8, i8)
32