xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenOpenCL/fpmath.cl (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambuctypedef __attribute__(( ext_vector_type(4) )) float float4;
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambucfloat spscalardiv(float a, float b) {
6f4a2713aSLionel Sambuc  // CHECK: @spscalardiv
7f4a2713aSLionel Sambuc  // CHECK: fdiv{{.*}}, !fpmath ![[MD:[0-9]+]]
8f4a2713aSLionel Sambuc  return a / b;
9f4a2713aSLionel Sambuc}
10f4a2713aSLionel Sambuc
11f4a2713aSLionel Sambucfloat4 spvectordiv(float4 a, float4 b) {
12f4a2713aSLionel Sambuc  // CHECK: @spvectordiv
13f4a2713aSLionel Sambuc  // CHECK: fdiv{{.*}}, !fpmath ![[MD]]
14f4a2713aSLionel Sambuc  return a / b;
15f4a2713aSLionel Sambuc}
16f4a2713aSLionel Sambuc
17f4a2713aSLionel Sambuc#pragma OPENCL EXTENSION cl_khr_fp64 : enable
18f4a2713aSLionel Sambuc
19f4a2713aSLionel Sambucdouble dpscalardiv(double a, double b) {
20f4a2713aSLionel Sambuc  // CHECK: @dpscalardiv
21f4a2713aSLionel Sambuc  // CHECK-NOT: !fpmath
22f4a2713aSLionel Sambuc  return a / b;
23f4a2713aSLionel Sambuc}
24f4a2713aSLionel Sambuc
25*0a6a1f1dSLionel Sambuc// CHECK: ![[MD]] = !{float 2.500000e+00}
26