[llvm-commits] [llvm] r62514 - in /llvm/trunk: test/ExecutionEngine/2007-05-12-APInt-Shl.ll unittests/ADT/APInt.cpp
Nick Lewycky
nicholas at mxc.ca
Mon Jan 19 10:08:33 PST 2009
Author: nicholas
Date: Mon Jan 19 12:08:33 2009
New Revision: 62514
URL: http://llvm.org/viewvc/llvm-project?rev=62514&view=rev
Log:
Port this test from dejagnu to unit testing.
The way this worked before was to test APInt by running
"lli -force-interpreter=true" knowing the lli uses APInt under the hood to
store its values. Now, we test APInt directly.
Added:
llvm/trunk/unittests/ADT/APInt.cpp
Removed:
llvm/trunk/test/ExecutionEngine/2007-05-12-APInt-Shl.ll
Removed: llvm/trunk/test/ExecutionEngine/2007-05-12-APInt-Shl.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/2007-05-12-APInt-Shl.ll?rev=62513&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/2007-05-12-APInt-Shl.ll (original)
+++ llvm/trunk/test/ExecutionEngine/2007-05-12-APInt-Shl.ll (removed)
@@ -1,30 +0,0 @@
-; RUN: llvm-as %s -f -o %t.bc
-; RUN: lli -force-interpreter=true %t.bc | tee %t.out | grep 10
-
-; Test that APInt shift left works when bitwidth > 64 and shiftamt == 0
-
-declare i32 @putchar(i32)
-
-define void @putBit(i65 %x, i65 %bitnum) {
- %tmp1 = shl i65 1, %bitnum
- %tmp2 = and i65 %x, %tmp1
- %cond = icmp ne i65 %tmp2, 0
- br i1 %cond, label %cond_true, label %cond_false
-
-cond_true:
- call i32 @putchar(i32 49)
- br label %cond_next
-
-cond_false:
- call i32 @putchar(i32 48)
- br label %cond_next
-
-cond_next:
- ret void
-}
-
-define i32 @main() {
- call void @putBit(i65 1, i65 0)
- call void @putBit(i65 0, i65 0)
- ret i32 0
-}
Added: llvm/trunk/unittests/ADT/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APInt.cpp?rev=62514&view=auto
==============================================================================
--- llvm/trunk/unittests/ADT/APInt.cpp (added)
+++ llvm/trunk/unittests/ADT/APInt.cpp Mon Jan 19 12:08:33 2009
@@ -0,0 +1,25 @@
+//===- llvm/unittest/ADT/APInt.cpp - APInt unit tests -----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+#include "llvm/ADT/APInt.h"
+
+using namespace llvm;
+
+namespace {
+
+// Test that APInt shift left works when bitwidth > 64 and shiftamt == 0
+TEST(APIntTest, ShiftLeftByZero) {
+ APInt One = APInt::getNullValue(65) + 1;
+ APInt Shl = One.shl(0);
+ EXPECT_EQ(Shl[0], true);
+ EXPECT_EQ(Shl[1], false);
+}
+
+}
More information about the llvm-commits
mailing list