llvm-project
36 строк · 1.4 Кб
1; REQUIRES: x86
2; RUN: llvm-as %s -o %t.o
3
4;; Verify that LTO behavior can be tweaked using -mattr.
5
6; RUN: %lld -mcpu haswell -mllvm -mattr=+fma %t.o -o %t.dylib -dylib
7; RUN: llvm-objdump --no-print-imm-hex -d --section="__text" --no-leading-addr --no-show-raw-insn %t.dylib | FileCheck %s --check-prefix=FMA
8
9; RUN: %lld -mcpu haswell -mllvm -mattr=-fma %t.o -o %t.dylib -dylib
10; RUN: llvm-objdump --no-print-imm-hex -d --section="__text" --no-leading-addr --no-show-raw-insn %t.dylib | FileCheck %s --check-prefix=NO-FMA
11
12; FMA: <_foo>:
13; FMA-NEXT: vrcpss %xmm0, %xmm0, %xmm1
14; FMA-NEXT: vfmsub213ss [[#]](%rip), %xmm1, %xmm0 ## xmm0 = (xmm1 * xmm0) - mem
15; FMA-NEXT: ## 0x
16; FMA-NEXT: vfnmadd132ss %xmm1, %xmm1, %xmm0
17; FMA-NEXT: retq
18
19; NO-FMA: <_foo>:
20; NO-FMA-NEXT: vrcpss %xmm0, %xmm0, %xmm1
21; NO-FMA-NEXT: vmulss %xmm1, %xmm0, %xmm0
22; NO-FMA-NEXT: vmovss [[#]](%rip), %xmm2 ## 0x
23; NO-FMA-NEXT: vsubss %xmm0, %xmm2, %xmm0
24; NO-FMA-NEXT: vmulss %xmm0, %xmm1, %xmm0
25; NO-FMA-NEXT: vaddss %xmm0, %xmm1, %xmm0
26; NO-FMA-NEXT: retq
27
28target triple = "x86_64-apple-darwin"
29target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
30
31define float @foo(float %x) #0 {
32%div = fdiv fast float 1.0, %x
33ret float %div
34}
35
36attributes #0 = { "unsafe-fp-math"="true" "reciprocal-estimates"="divf,vec-divf" }
37