2018-03-06 03:11:20 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=-sse,-sse2,-sse3 | FileCheck %s --check-prefix=X87
|
|
|
|
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck %s --check-prefix=X87UNSAFE
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
|
2005-04-02 13:35:00 +08:00
|
|
|
|
2007-09-27 05:12:10 +08:00
|
|
|
declare float @fabsf(float)
|
|
|
|
declare x86_fp80 @fabsl(x86_fp80)
|
2005-04-02 13:35:00 +08:00
|
|
|
|
2007-09-27 05:12:10 +08:00
|
|
|
define float @test1(float %X) {
|
2018-03-06 03:11:20 +08:00
|
|
|
; X87-LABEL: test1:
|
|
|
|
; X87: # %bb.0:
|
|
|
|
; X87-NEXT: flds {{[0-9]+}}(%esp)
|
|
|
|
; X87-NEXT: fabs
|
|
|
|
; X87-NEXT: retl
|
|
|
|
;
|
|
|
|
; X87UNSAFE-LABEL: test1:
|
|
|
|
; X87UNSAFE: # %bb.0:
|
|
|
|
; X87UNSAFE-NEXT: flds {{[0-9]+}}(%esp)
|
|
|
|
; X87UNSAFE-NEXT: fabs
|
|
|
|
; X87UNSAFE-NEXT: retl
|
|
|
|
;
|
|
|
|
; X64-LABEL: test1:
|
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: andps {{.*}}(%rip), %xmm0
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%Y = call float @fabsf(float %X) readnone
|
|
|
|
ret float %Y
|
2005-04-02 13:35:00 +08:00
|
|
|
}
|
2012-07-03 11:59:15 +08:00
|
|
|
|
2018-03-30 23:42:52 +08:00
|
|
|
define x86_fp80 @test2(x86_fp80 %X) {
|
2018-03-06 03:11:20 +08:00
|
|
|
; X87-LABEL: test2:
|
|
|
|
; X87: # %bb.0:
|
|
|
|
; X87-NEXT: fldt {{[0-9]+}}(%esp)
|
|
|
|
; X87-NEXT: fabs
|
|
|
|
; X87-NEXT: retl
|
|
|
|
;
|
2018-03-30 23:42:52 +08:00
|
|
|
; X87UNSAFE-LABEL: test2:
|
2018-03-06 03:11:20 +08:00
|
|
|
; X87UNSAFE: # %bb.0:
|
|
|
|
; X87UNSAFE-NEXT: fldt {{[0-9]+}}(%esp)
|
|
|
|
; X87UNSAFE-NEXT: fabs
|
|
|
|
; X87UNSAFE-NEXT: retl
|
|
|
|
;
|
2018-03-30 23:42:52 +08:00
|
|
|
; X64-LABEL: test2:
|
2018-03-06 03:11:20 +08:00
|
|
|
; X64: # %bb.0:
|
|
|
|
; X64-NEXT: fldt {{[0-9]+}}(%rsp)
|
|
|
|
; X64-NEXT: fabs
|
|
|
|
; X64-NEXT: retq
|
|
|
|
%Y = call x86_fp80 @fabsl(x86_fp80 %X) readnone
|
|
|
|
ret x86_fp80 %Y
|
2007-09-27 05:12:10 +08:00
|
|
|
}
|
|
|
|
|