; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | |
; RUN: llc -verify-machineinstrs \ | |
; RUN: -mtriple=aarch64-unknown-unknown < %s | FileCheck %s | |
declare i64 @llvm.abs.i64(i64, i1 immarg) | |
define i64@neg_abs(i64 %x) { | |
; CHECK-LABEL: neg_abs: | |
; CHECK: // %bb.0: | |
; CHECK-NEXT: cmp x0, #0 // =0 | |
; CHECK-NEXT: cneg x8, x0, mi | |
; CHECK-NEXT: neg x0, x8 | |
; CHECK-NEXT: ret | |
%abs = tail call i64 @llvm.abs.i64(i64 %x, i1 true) | |
%neg = sub nsw i64 0, %abs | |
ret i64 %neg | |
} |