|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| 2 | +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=0 -mattr=+x87,+sse,+sse2 -o - | FileCheck %s --check-prefix=X64 |
| 3 | +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -global-isel=1 -mattr=+x87,+sse,+sse2 -o - | FileCheck %s -check-prefixes=GISEL |
| 4 | + |
| 5 | +define float @test_float_abs(float %arg) { |
| 6 | +; X64-LABEL: test_float_abs: |
| 7 | +; X64: # %bb.0: |
| 8 | +; X64-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 |
| 9 | +; X64-NEXT: retq |
| 10 | +; |
| 11 | +; GISEL-LABEL: test_float_abs: |
| 12 | +; GISEL: # %bb.0: |
| 13 | +; GISEL-NEXT: movd %xmm0, %eax |
| 14 | +; GISEL-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF |
| 15 | +; GISEL-NEXT: movd %eax, %xmm0 |
| 16 | +; GISEL-NEXT: retq |
| 17 | + %abs = tail call float @llvm.fabs.f32(float %arg) |
| 18 | + ret float %abs |
| 19 | +} |
| 20 | + |
| 21 | +define double @test_double_abs(double %arg) { |
| 22 | +; X64-LABEL: test_double_abs: |
| 23 | +; X64: # %bb.0: |
| 24 | +; X64-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 |
| 25 | +; X64-NEXT: retq |
| 26 | +; |
| 27 | +; GISEL-LABEL: test_double_abs: |
| 28 | +; GISEL: # %bb.0: |
| 29 | +; GISEL-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF |
| 30 | +; GISEL-NEXT: movq %xmm0, %rcx |
| 31 | +; GISEL-NEXT: andq %rax, %rcx |
| 32 | +; GISEL-NEXT: movq %rcx, %xmm0 |
| 33 | +; GISEL-NEXT: retq |
| 34 | + %abs = tail call double @llvm.fabs.f64(double %arg) |
| 35 | + ret double %abs |
| 36 | +} |
| 37 | + |
| 38 | +define x86_fp80 @test_x86_fp80_abs(x86_fp80 %arg) { |
| 39 | +; X64-LABEL: test_x86_fp80_abs: |
| 40 | +; X64: # %bb.0: |
| 41 | +; X64-NEXT: fldt {{[0-9]+}}(%rsp) |
| 42 | +; X64-NEXT: fabs |
| 43 | +; X64-NEXT: retq |
| 44 | +; |
| 45 | +; GISEL-LABEL: test_x86_fp80_abs: |
| 46 | +; GISEL: # %bb.0: |
| 47 | +; GISEL-NEXT: fldt {{[0-9]+}}(%rsp) |
| 48 | +; GISEL-NEXT: fabs |
| 49 | +; GISEL-NEXT: retq |
| 50 | + %abs = tail call x86_fp80 @llvm.fabs.f80(x86_fp80 %arg) |
| 51 | + ret x86_fp80 %abs |
| 52 | +} |
0 commit comments