[PowerPC] Add negated abs test using llvm.abs intrinsic. NFC.

This commit is contained in:
Kai Luo 2020-11-17 09:28:56 +00:00
parent 218500d823
commit c2460c3254
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -ppc-asm-full-reg-names -verify-machineinstrs \
; RUN: -mtriple=powerpc64le-linux-gnu < %s | FileCheck \
; RUN: -check-prefix=CHECK-LE %s
declare i64 @llvm.abs.i64(i64, i1 immarg)
define i64@neg_abs(i64 %x) {
; CHECK-LE-LABEL: neg_abs:
; CHECK-LE: # %bb.0:
; CHECK-LE-NEXT: sradi r4, r3, 63
; CHECK-LE-NEXT: add r3, r3, r4
; CHECK-LE-NEXT: xor r3, r3, r4
; CHECK-LE-NEXT: neg r3, r3
; CHECK-LE-NEXT: blr
%abs = tail call i64 @llvm.abs.i64(i64 %x, i1 true)
%neg = sub nsw i64 0, %abs
ret i64 %neg
}