Match sub-vector load/store operand order to regular load/store.

Bug swiftshader:27

Change-Id: Ic116a804fed80222ad9a41f219c937f28104f225
Reviewed-on: https://swiftshader-review.googlesource.com/8271
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp
index 9cb3b70..5533630 100644
--- a/src/Reactor/SubzeroReactor.cpp
+++ b/src/Reactor/SubzeroReactor.cpp
@@ -113,7 +113,7 @@
 	{
 		return reinterpret_cast<const SectionHeader*>((intptr_t)elfHeader + elfHeader->e_shoff);
 	}
- 
+
 	inline const SectionHeader *elfSection(const ElfHeader *elfHeader, int index)
 	{
 		return &sectionHeader(elfHeader)[index];
@@ -122,25 +122,25 @@
 	static void *relocateSymbol(const ElfHeader *elfHeader, const Elf32_Rel &relocation, const SectionHeader &relocationTable)
 	{
 		const SectionHeader *target = elfSection(elfHeader, relocationTable.sh_info);
- 
+
 		intptr_t address = (intptr_t)elfHeader + target->sh_offset;
 		int32_t *patchSite = (int*)(address + relocation.r_offset);
 		uint32_t index = relocation.getSymbol();
 		int table = relocationTable.sh_link;
 		void *symbolValue = nullptr;
-		
+
 		if(index != SHN_UNDEF)
 		{
 			if(table == SHN_UNDEF) return nullptr;
 			const SectionHeader *symbolTable = elfSection(elfHeader, table);
- 
+
 			uint32_t symtab_entries = symbolTable->sh_size / symbolTable->sh_entsize;
 			if(index >= symtab_entries)
 			{
 				assert(index < symtab_entries && "Symbol Index out of range");
 				return nullptr;
 			}
- 
+
 			intptr_t symbolAddress = (intptr_t)elfHeader + symbolTable->sh_offset;
 			Elf32_Sym &symbol = ((Elf32_Sym*)symbolAddress)[index];
 			uint16_t section = symbol.st_shndx;
@@ -178,7 +178,7 @@
 	static void *relocateSymbol(const ElfHeader *elfHeader, const Elf64_Rela &relocation, const SectionHeader &relocationTable)
 	{
 		const SectionHeader *target = elfSection(elfHeader, relocationTable.sh_info);
- 
+
 		intptr_t address = (intptr_t)elfHeader + target->sh_offset;
 		int32_t *patchSite = (int*)(address + relocation.r_offset);
 		uint32_t index = relocation.getSymbol();
@@ -189,14 +189,14 @@
 		{
 			if(table == SHN_UNDEF) return nullptr;
 			const SectionHeader *symbolTable = elfSection(elfHeader, table);
- 
+
 			uint32_t symtab_entries = symbolTable->sh_size / symbolTable->sh_entsize;
 			if(index >= symtab_entries)
 			{
 				assert(index < symtab_entries && "Symbol Index out of range");
 				return nullptr;
 			}
- 
+
 			intptr_t symbolAddress = (intptr_t)elfHeader + symbolTable->sh_offset;
 			Elf64_Sym &symbol = ((Elf64_Sym*)symbolAddress)[index];
 			uint16_t section = symbol.st_shndx;
@@ -685,8 +685,8 @@
 					const Ice::Intrinsics::IntrinsicInfo intrinsic = {Ice::Intrinsics::LoadSubVector, Ice::Intrinsics::SideEffects_F, Ice::Intrinsics::ReturnsTwice_F, Ice::Intrinsics::MemoryWrite_F};
 					auto target = ::context->getConstantUndef(Ice::IceType_i32);
 					auto load = Ice::InstIntrinsicCall::create(::function, 2, result, target, intrinsic);
-					load->addArg(::context->getConstantInt32(4));
 					load->addArg(ptr);
+					load->addArg(::context->getConstantInt32(4));
 					::basicBlock->appendInst(load);
 				}
 				break;
@@ -698,8 +698,8 @@
 					const Ice::Intrinsics::IntrinsicInfo intrinsic = {Ice::Intrinsics::LoadSubVector, Ice::Intrinsics::SideEffects_F, Ice::Intrinsics::ReturnsTwice_F, Ice::Intrinsics::MemoryWrite_F};
 					auto target = ::context->getConstantUndef(Ice::IceType_i32);
 					auto load = Ice::InstIntrinsicCall::create(::function, 2, result, target, intrinsic);
-					load->addArg(::context->getConstantInt32(8));
 					load->addArg(ptr);
+					load->addArg(::context->getConstantInt32(8));
 					::basicBlock->appendInst(load);
 				}
 				break;
@@ -729,9 +729,9 @@
 					const Ice::Intrinsics::IntrinsicInfo intrinsic = {Ice::Intrinsics::StoreSubVector, Ice::Intrinsics::SideEffects_T, Ice::Intrinsics::ReturnsTwice_F, Ice::Intrinsics::MemoryWrite_T};
 					auto target = ::context->getConstantUndef(Ice::IceType_i32);
 					auto store = Ice::InstIntrinsicCall::create(::function, 3, nullptr, target, intrinsic);
-					store->addArg(::context->getConstantInt32(4));
 					store->addArg(value);
 					store->addArg(ptr);
+					store->addArg(::context->getConstantInt32(4));
 					::basicBlock->appendInst(store);
 				}
 				break;
@@ -743,9 +743,9 @@
 					const Ice::Intrinsics::IntrinsicInfo intrinsic = {Ice::Intrinsics::StoreSubVector, Ice::Intrinsics::SideEffects_T, Ice::Intrinsics::ReturnsTwice_F, Ice::Intrinsics::MemoryWrite_T};
 					auto target = ::context->getConstantUndef(Ice::IceType_i32);
 					auto store = Ice::InstIntrinsicCall::create(::function, 3, nullptr, target, intrinsic);
-					store->addArg(::context->getConstantInt32(8));
 					store->addArg(value);
 					store->addArg(ptr);
+					store->addArg(::context->getConstantInt32(8));
 					::basicBlock->appendInst(store);
 				}
 				break;
@@ -1245,7 +1245,7 @@
 		variableDeclaration->setAlignment(alignment);
 		variableDeclaration->setIsConstant(true);
 		variableDeclaration->addInitializer(dataInitializer);
-		
+
 		::function->addGlobal(variableDeclaration);
 
 		constexpr int32_t offset = 0;
diff --git a/third_party/pnacl-subzero b/third_party/pnacl-subzero
index 83425de..a29da90 160000
--- a/third_party/pnacl-subzero
+++ b/third_party/pnacl-subzero
@@ -1 +1 @@
-Subproject commit 83425dec5ecae21e092a9a440845ce99a13ded69
+Subproject commit a29da906bf910a32de3a81ef43d6ec43f138f2ab