Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Introduction to SSE Programming

, 10 Jul 2003
An article describes programming floating-point calculations using Streaming SIMD Extensions
// SSESampleDlg.h : header file
//

#pragma once
#include "afxwin.h"

#include <xmmintrin.h>      // __m128 data type and SSE functions


#define ARRAY_SIZE 100000

#pragma warning(disable : 4324)

// CSSESampleDlg dialog
class CSSESampleDlg : public CDialog
{
// Construction
public:
	CSSESampleDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_SSESAMPLE_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

    // Arrays processed by SSE should have 16 bytes alignment:
    __declspec(align(16)) float m_fInitialArray[ARRAY_SIZE];
    __declspec(align(16)) float m_fResultArray[ARRAY_SIZE];


    // minimum and maximum values in the result array
    float m_fMin;
    float m_fMax;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnBnClickedButtonCplusplus();
    afx_msg void OnBnClickedButtonReset();
    afx_msg void OnBnClickedButtonSseAssembly();
    afx_msg void OnBnClickedButtonSseC();

    CStatic m_static_minimum;
    CStatic m_static_time;
    CStatic m_static_maximum;
    CListBox m_list_box;

protected:
    void InitArray();
    void ShowMinMax();
    void AddString(LPCTSTR s);
    void ClearList();
    void ShowArray(float* pArray);
    void ConvertFloatToString(CString& s, float f);
    void ShowTime(__int64 nTime);

};

#pragma warning(default : 4324)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Alex Fr
Software Developer
Israel Israel
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 11 Jul 2003
Article Copyright 2003 by Alex Fr
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid