xref: /llvm-project/llvm/test/CodeGen/PowerPC/fabs.ll (revision 09dd4d870e192da73594b713bb201859e5a09efb)
1; RUN: llc -verify-machineinstrs -ppc-asm-full-reg-names < %s -mattr=-vsx -mtriple=powerpc-unknown-linux-gnu | FileCheck %s
2
3define double @fabs(double %f) {
4; CHECK-LABEL: fabs:
5; CHECK:       # %bb.0:
6; CHECK-NEXT:    fabs f1, f1
7; CHECK-NEXT:    blr
8;
9  %t = tail call double @fabs( double %f ) readnone
10  ret double %t
11}
12
13define float @bitcast_fabs(float %x) {
14; CHECK-LABEL: bitcast_fabs:
15; CHECK:       # %bb.0:
16; CHECK-NEXT: fabs f1, f1
17; CHECK-NEXT:    blr
18;
19  %bc1 = bitcast float %x to i32
20  %and = and i32 %bc1, 2147483647
21  %bc2 = bitcast i32 %and to float
22  ret float %bc2
23}
24
25