adjust llvm code to the changes in 2.3
authorZack Rusin <zack@tungstengraphics.com>
Mon, 12 May 2008 21:17:18 +0000 (17:17 -0400)
committerZack Rusin <zack@tungstengraphics.com>
Mon, 12 May 2008 21:17:18 +0000 (17:17 -0400)
src/gallium/auxiliary/gallivm/instructions.cpp
src/gallium/auxiliary/gallivm/storage.cpp
src/gallium/auxiliary/gallivm/storagesoa.cpp

index 95a670edafc65ea6bea24f0c6f5e107e29d39b6d..1a98491b82a5e92514242af5c1294fb846acfef7 100644 (file)
@@ -166,10 +166,9 @@ llvm::Value * Instructions::rsq(llvm::Value *in1)
    Value *abs  = callFAbs(x);
    Value *sqrt = callFSqrt(abs);
 
-   Value *rsqrt = m_builder.CreateFDiv(ConstantFP::get(Type::FloatTy,
-                                                                APFloat(1.f)),
-                                                sqrt,
-                                                name("rsqrt"));
+   Value *rsqrt = m_builder.CreateFDiv(ConstantFP::get(APFloat(1.f)),
+                                       sqrt,
+                                       name("rsqrt"));
    return vectorFromVals(rsqrt, rsqrt, rsqrt, rsqrt);
 }
 
@@ -278,9 +277,8 @@ llvm::Value * Instructions::rcp(llvm::Value *in1)
    Value *x1 = m_builder.CreateExtractElement(in1,
                                               m_storage->constantInt(0),
                                               name("x1"));
-   Value *res = m_builder.CreateFDiv(ConstantFP::get(Type::FloatTy,
-                                                              APFloat(1.f)),
-                                              x1, name("rcp"));
+   Value *res = m_builder.CreateFDiv(ConstantFP::get(APFloat(1.f)),
+                                     x1, name("rcp"));
    return vectorFromVals(res, res, res, res);
 }
 
@@ -319,13 +317,13 @@ llvm::Value * Instructions::dst(llvm::Value *in1, llvm::Value *in2)
                                              m_storage->constantInt(3),
                                              name("w"));
    Value *ry = m_builder.CreateMul(y1, y2, name("tyuy"));
-   return vectorFromVals(ConstantFP::get(Type::FloatTy, APFloat(1.f)),
+   return vectorFromVals(ConstantFP::get(APFloat(1.f)),
                          ry, z, w);
 }
 
 llvm::Value * Instructions::ex2(llvm::Value *in)
 {
-   llvm::Value *val = callPow(ConstantFP::get(Type::FloatTy, APFloat(2.f)),
+   llvm::Value *val = callPow(ConstantFP::get(APFloat(2.f)),
                               m_builder.CreateExtractElement(
                                  in, m_storage->constantInt(0),
                                  name("x1")));
@@ -526,7 +524,7 @@ llvm::Function * Instructions::declarePrintf()
 
 llvm::Value * Instructions::sgt(llvm::Value *in1, llvm::Value *in2)
 {
-   Constant *const1f = ConstantFP::get(Type::FloatTy, APFloat(1.000000e+00f));
+   Constant *const1f = ConstantFP::get(APFloat(1.000000e+00f));
    Constant *const0f = Constant::getNullValue(Type::FloatTy);
 
    std::vector<llvm::Value*> vec1 = extractVector(in1);
@@ -547,7 +545,7 @@ llvm::Value * Instructions::sgt(llvm::Value *in1, llvm::Value *in2)
 }
 llvm::Value * Instructions::sge(llvm::Value *in1, llvm::Value *in2)
 {
-   Constant *const1f = ConstantFP::get(Type::FloatTy, APFloat(1.000000e+00f));
+   Constant *const1f = ConstantFP::get(APFloat(1.000000e+00f));
    Constant *const0f = Constant::getNullValue(Type::FloatTy);
 
    std::vector<llvm::Value*> vec1 = extractVector(in1);
@@ -571,7 +569,7 @@ llvm::Value * Instructions::sge(llvm::Value *in1, llvm::Value *in2)
 
 llvm::Value * Instructions::slt(llvm::Value *in1, llvm::Value *in2)
 {
-   Constant *const1f = ConstantFP::get(Type::FloatTy, APFloat(1.000000e+00f));
+   Constant *const1f = ConstantFP::get(APFloat(1.000000e+00f));
    Constant *const0f = Constant::getNullValue(Type::FloatTy);
 
    std::vector<llvm::Value*> vec1 = extractVector(in1);
@@ -814,10 +812,10 @@ llvm::Function * Instructions::findFunction(int label)
 llvm::Value * Instructions::constVector(float x, float y, float z, float w)
 {
    std::vector<Constant*> vec(4);
-   vec[0] = ConstantFP::get(Type::FloatTy, APFloat(x));
-   vec[1] = ConstantFP::get(Type::FloatTy, APFloat(y));
-   vec[2] = ConstantFP::get(Type::FloatTy, APFloat(z));
-   vec[3] = ConstantFP::get(Type::FloatTy, APFloat(w));
+   vec[0] = ConstantFP::get(APFloat(x));
+   vec[1] = ConstantFP::get(APFloat(y));
+   vec[2] = ConstantFP::get(APFloat(z));
+   vec[3] = ConstantFP::get(APFloat(w));
    return ConstantVector::get(m_floatVecType, vec);
 }
 
index 9d9fd12360418dcfd84102b11a819bd4c9a7c9a9..6f373f6dd5e614cdff57df49dfeaf29318c0cdaa 100644 (file)
@@ -69,10 +69,10 @@ llvm::Constant *Storage::shuffleMask(int vec)
 {
    if (!m_extSwizzleVec) {
       std::vector<Constant*> elems;
-      elems.push_back(ConstantFP::get(Type::FloatTy, APFloat(0.f)));
-      elems.push_back(ConstantFP::get(Type::FloatTy, APFloat(1.f)));
-      elems.push_back(ConstantFP::get(Type::FloatTy, APFloat(0.f)));
-      elems.push_back(ConstantFP::get(Type::FloatTy, APFloat(1.f)));
+      elems.push_back(ConstantFP::get(APFloat(0.f)));
+      elems.push_back(ConstantFP::get(APFloat(1.f)));
+      elems.push_back(ConstantFP::get(APFloat(0.f)));
+      elems.push_back(ConstantFP::get(APFloat(1.f)));
       m_extSwizzleVec = ConstantVector::get(m_floatVecType, elems);
    }
 
@@ -295,10 +295,10 @@ llvm::Value * Storage::immediateElement(int idx)
 void Storage::addImmediate(float *val)
 {
    std::vector<Constant*> vec(4);
-   vec[0] = ConstantFP::get(Type::FloatTy, APFloat(val[0]));
-   vec[1] = ConstantFP::get(Type::FloatTy, APFloat(val[1]));
-   vec[2] = ConstantFP::get(Type::FloatTy, APFloat(val[2]));
-   vec[3] = ConstantFP::get(Type::FloatTy, APFloat(val[3]));
+   vec[0] = ConstantFP::get(APFloat(val[0]));
+   vec[1] = ConstantFP::get(APFloat(val[1]));
+   vec[2] = ConstantFP::get(APFloat(val[2]));
+   vec[3] = ConstantFP::get(APFloat(val[3]));
    m_immediates.push_back(ConstantVector::get(m_floatVecType, vec));
 }
 
index 0e6e68c9d709d4d0c0885f6cdd113c62933d2f5c..78d754371f09b6705e32ab1e1eb9d90f56fe2caf 100644 (file)
@@ -264,10 +264,10 @@ llvm::Constant * StorageSoa::createConstGlobalVector(const std::vector<float> &v
 {
    VectorType *vectorType = VectorType::get(Type::FloatTy, 4);
    std::vector<Constant*> immValues;
-   ConstantFP *constx = ConstantFP::get(Type::FloatTy, APFloat(vec[0]));
-   ConstantFP *consty = ConstantFP::get(Type::FloatTy, APFloat(vec[1]));
-   ConstantFP *constz = ConstantFP::get(Type::FloatTy, APFloat(vec[2]));
-   ConstantFP *constw = ConstantFP::get(Type::FloatTy, APFloat(vec[3]));
+   ConstantFP *constx = ConstantFP::get(APFloat(vec[0]));
+   ConstantFP *consty = ConstantFP::get(APFloat(vec[1]));
+   ConstantFP *constz = ConstantFP::get(APFloat(vec[2]));
+   ConstantFP *constw = ConstantFP::get(APFloat(vec[3]));
    immValues.push_back(constx);
    immValues.push_back(consty);
    immValues.push_back(constz);