|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: llc < %s -mtriple=x86_64-- -mattr=-x87 | FileCheck %s --check-prefixes=X64 |
| 3 | +; RUN: llc < %s -mtriple=x86_64-- -mattr=-x87 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X64 |
| 4 | +; RUN: llc < %s -mtriple=i686-- -mattr=-x87 | FileCheck %s --check-prefixes=X86 |
| 5 | +; RUN: llc < %s -mtriple=i686-- -mattr=-x87 -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=FASTISEL-X86 |
| 6 | + |
| 7 | + |
| 8 | +define float @test_float_abs(float %arg) { |
| 9 | +; X64-LABEL: test_float_abs: |
| 10 | +; X64: # %bb.0: |
| 11 | +; X64-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 |
| 12 | +; X64-NEXT: retq |
| 13 | +; |
| 14 | +; X86-LABEL: test_float_abs: |
| 15 | +; X86: # %bb.0: |
| 16 | +; X86-NEXT: movl $2147483647, %eax # imm = 0x7FFFFFFF |
| 17 | +; X86-NEXT: andl {{[0-9]+}}(%esp), %eax |
| 18 | +; X86-NEXT: retl |
| 19 | +; |
| 20 | +; FASTISEL-X86-LABEL: test_float_abs: |
| 21 | +; FASTISEL-X86: # %bb.0: |
| 22 | +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax |
| 23 | +; FASTISEL-X86-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF |
| 24 | +; FASTISEL-X86-NEXT: retl |
| 25 | + %abs = tail call float @llvm.fabs.f32(float %arg) |
| 26 | + ret float %abs |
| 27 | +} |
| 28 | + |
| 29 | +define double @test_double_abs(double %arg) { |
| 30 | +; X64-LABEL: test_double_abs: |
| 31 | +; X64: # %bb.0: |
| 32 | +; X64-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 |
| 33 | +; X64-NEXT: retq |
| 34 | +; |
| 35 | +; X86-LABEL: test_double_abs: |
| 36 | +; X86: # %bb.0: |
| 37 | +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax |
| 38 | +; X86-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF |
| 39 | +; X86-NEXT: andl {{[0-9]+}}(%esp), %edx |
| 40 | +; X86-NEXT: retl |
| 41 | +; |
| 42 | +; FASTISEL-X86-LABEL: test_double_abs: |
| 43 | +; FASTISEL-X86: # %bb.0: |
| 44 | +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx |
| 45 | +; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax |
| 46 | +; FASTISEL-X86-NEXT: andl $2147483647, %edx # imm = 0x7FFFFFFF |
| 47 | +; FASTISEL-X86-NEXT: retl |
| 48 | + %abs = tail call double @llvm.fabs.f64(double %arg) |
| 49 | + ret double %abs |
| 50 | +} |
0 commit comments