fp-contract.cu 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. // REQUIRES: x86-registered-target
  2. // REQUIRES: nvptx-registered-target
  3. // By default we should fuse multiply/add into fma instruction.
  4. // RUN: %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -S \
  5. // RUN: -disable-llvm-passes -o - %s | FileCheck -check-prefix ENABLED %s
  6. // Explicit -ffp-contract=fast
  7. // RUN: %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -S \
  8. // RUN: -ffp-contract=fast -disable-llvm-passes -o - %s \
  9. // RUN: | FileCheck -check-prefix ENABLED %s
  10. // Explicit -ffp-contract=on -- fusing by front-end.
  11. // RUN: %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -S \
  12. // RUN: -ffp-contract=on -disable-llvm-passes -o - %s \
  13. // RUN: | FileCheck -check-prefix ENABLED %s
  14. // Explicit -ffp-contract=off should disable instruction fusing.
  15. // RUN: %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -S \
  16. // RUN: -ffp-contract=off -disable-llvm-passes -o - %s \
  17. // RUN: | FileCheck -check-prefix DISABLED %s
  18. #include "Inputs/cuda.h"
  19. __host__ __device__ float func(float a, float b, float c) { return a + b * c; }
  20. // ENABLED: fma.rn.f32
  21. // ENABLED-NEXT: st.param.f32
  22. // DISABLED: mul.rn.f32
  23. // DISABLED-NEXT: add.rn.f32
  24. // DISABLED-NEXT: st.param.f32