[llvm-commits] [llvm] r146369 - /llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll

Chandler Carruth chandlerc at gmail.com
Mon Dec 12 03:23:12 PST 2011


Author: chandlerc
Date: Mon Dec 12 05:23:11 2011
New Revision: 146369

URL: http://llvm.org/viewvc/llvm-project?rev=146369&view=rev
Log:
Add an explicit test of the auto-upgrade functionality for the new
intrinsic syntax.

Now that this is explicitly covered, I plan to upgrade the existing test
suite to use an explicit immediate. Note that I plan to specify 'true'
in most places rather than the auto-upgraded value as that is the far
more common value to end up here as that is the value coming from GCC's
builtins. The only place I'm likely to put a 'false' in is when testing
x86 which actually has different instructions for the two variants.

Added:
    llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll

Added: llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll?rev=146369&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll (added)
+++ llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll Mon Dec 12 05:23:11 2011
@@ -0,0 +1,44 @@
+; Test to make sure intrinsics are automatically upgraded.
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+declare i8 @llvm.ctlz.i8(i8)
+declare i16 @llvm.ctlz.i16(i16)
+declare i32 @llvm.ctlz.i32(i32)
+declare i42 @llvm.ctlz.i42(i42)  ; Not a power-of-2
+
+define void @test.ctlz(i8 %a, i16 %b, i32 %c, i42 %d) {
+; CHECK: @test.ctlz
+
+entry:
+  ; CHECK: call i8 @llvm.ctlz.i8(i8 %a, i1 false)
+  call i8 @llvm.ctlz.i8(i8 %a)
+  ; CHECK: call i16 @llvm.ctlz.i16(i16 %b, i1 false)
+  call i16 @llvm.ctlz.i16(i16 %b)
+  ; CHECK: call i32 @llvm.ctlz.i32(i32 %c, i1 false)
+  call i32 @llvm.ctlz.i32(i32 %c)
+  ; CHECK: call i42 @llvm.ctlz.i42(i42 %d, i1 false)
+  call i42 @llvm.ctlz.i42(i42 %d)
+
+  ret void
+}
+
+declare i8 @llvm.cttz.i8(i8)
+declare i16 @llvm.cttz.i16(i16)
+declare i32 @llvm.cttz.i32(i32)
+declare i42 @llvm.cttz.i42(i42)  ; Not a power-of-2
+
+define void @test.cttz(i8 %a, i16 %b, i32 %c, i42 %d) {
+; CHECK: @test.cttz
+
+entry:
+  ; CHECK: call i8 @llvm.cttz.i8(i8 %a, i1 false)
+  call i8 @llvm.cttz.i8(i8 %a)
+  ; CHECK: call i16 @llvm.cttz.i16(i16 %b, i1 false)
+  call i16 @llvm.cttz.i16(i16 %b)
+  ; CHECK: call i32 @llvm.cttz.i32(i32 %c, i1 false)
+  call i32 @llvm.cttz.i32(i32 %c)
+  ; CHECK: call i42 @llvm.cttz.i42(i42 %d, i1 false)
+  call i42 @llvm.cttz.i42(i42 %d)
+
+  ret void
+}





More information about the llvm-commits mailing list