Skip to content

Instantly share code, notes, and snippets.

View prophile's full-sized avatar

Alistair Lynn prophile

View GitHub Profile
/* "Q", by tjh05r, "friendly indenting" version
* (C), or something, me. No blatant copying/sacrificial rites please.
*
* Disclaimer: No responsibility is taken by the author for any damage occuring
* from the reading, cognition or execution of this code.
*
* Please feel free to leave your brain in a jar by the door.
*/
class Q {
<?php
$input = file_get_contents($argv[1]);
$closebrackets = 0;
$len = strlen($input);
echo <<<EOF
class Q {
varying vec2 V;
varying vec2 TX;
uniform vec2 Target;
uniform float Angle;
uniform float Magnitude;
uniform sampler2DRect sampler;
const float TEXELDIST = 20.0;
const float MAGFACTOR = 3.0;
Consider the following .ll:
define i32 @foo(i32 %arg) nounwind readnone {
bb:
switch i32 %arg, label %bb2 [
i32 2, label %bb1
i32 4, label %bb1
i32 6, label %bb1
]
define {i64, i1} @addo.apint.i64 ( i64 %left, i64 %right )
{
entry:
%extleft = zext i64 %left to i65
%extright = zext i64 %right to i65
%sum = add i65 %extleft, %extright
%res.0 = trunc i65 %sum to i64
%overflow = and i65 %sum, -18446744073709551616
%res.1 = icmp ne i65 %overflow, 0
%final0 = insertvalue {i64, i1} undef, i64 %res.0, 0
Index: lib/Transforms/Scalar/InstructionCombining.cpp
===================================================================
--- lib/Transforms/Scalar/InstructionCombining.cpp (revision 86930)
+++ lib/Transforms/Scalar/InstructionCombining.cpp (working copy)
@@ -9842,6 +9842,158 @@
if (Operand->getIntrinsicID() == Intrinsic::bswap)
return ReplaceInstUsesWith(CI, Operand->getOperand(1));
break;
+ case Intrinsic::uadd_with_overflow: {
+ const IntegerType *IT = cast<IntegerType>(II->getOperand(1)->getType());
NSString* ReadLine ()
{
char buffer[2048];
fgets(buffer, sizeof(buffer), stdin);
return [NSString stringWithUTF8String:buffer];
}
Index: test/Transforms/InstCombine/intrinsics.ll
===================================================================
--- test/Transforms/InstCombine/intrinsics.ll (revision 90007)
+++ test/Transforms/InstCombine/intrinsics.ll (working copy)
@@ -1,12 +1,79 @@
; RUN: opt %s -instcombine -S | FileCheck %s
-declare {i8, i1} @llvm.uadd.with.overflow.i8(i8, i8)
+%overflow.result = type {i8, i1}
Index: src/main.cpp
===================================================================
--- src/main.cpp (revision 1638)
+++ src/main.cpp (working copy)
@@ -7,6 +7,32 @@
// See http://www.gnu.org/copyleft/gpl.html for details.
////////////////////////////////////////////////////////////////////////////////
+/*
+ _______________________________________________________________________________
diff --git a/Engine/Graphics/ImageLoader.cpp b/Engine/Graphics/ImageLoader.cpp
index bc08c22..8aa9b8b 100644
--- a/Engine/Graphics/ImageLoader.cpp
+++ b/Engine/Graphics/ImageLoader.cpp
@@ -24,15 +24,17 @@ GLuint CreateTexture ( SDL_Surface* surface, bool autofree, bool rectangle )
glBindTexture(target, texID);
if (surface->format->BytesPerPixel == 3)
{
+ GLenum format = (surface->format->Rmask) != 0xFF ? GL_RGB : GL_BGR_EXT;
glTexImage2D(target, 0, GL_RGB,