avr-llvm / llvm

[MERGED UPSTREAM] AVR backend for the LLVM compiler library
220 stars 21 forks source link

Support MULH[US] for all integer types #190

Closed shepmaster closed 8 years ago

shepmaster commented 8 years ago

Before merging:


Both of these now compile:

; RUN: llc < %s -march=avr | FileCheck %s
; XFAIL:

define i1 @foo(i8, i8) unnamed_addr {
; CHECK-LABEL: foo:
entry-block:
  %2 = tail call { i8, i1 } @llvm.umul.with.overflow.i8(i8 %0, i8 %1)
  %3 = extractvalue { i8, i1 } %2, 1
  ret i1 %3
}

declare { i8, i1 } @llvm.umul.with.overflow.i8(i8, i8)

and

; RUN: llc < %s -march=avr | FileCheck %s
; XFAIL:

define i1 @multiplication_did_overflow(i8, i8) unnamed_addr {
; CHECK-LABEL: multiplication_did_overflow:
entry-block:
  %2 = tail call { i8, i1 } @llvm.smul.with.overflow.i8(i8 %0, i8 %1)
  %3 = extractvalue { i8, i1 } %2, 1
  ret i1 %3
}

declare { i8, i1 } @llvm.smul.with.overflow.i8(i8, i8)
shepmaster commented 8 years ago

@dylanmckay this one is ready for review!

shepmaster commented 8 years ago

@dylanmckay tests added; let me know how close I got to what you wanted.

dylanmckay commented 8 years ago

@shepmaster perfect!